Skip to content

Commit 03a1fd1

Browse files
committed
air-submit: support specifying model
Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 9941074 commit 03a1fd1

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

air-submit.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ def read_patch_files(patch_files: List[str]) -> List[str]:
8484
def submit_review(url: str, token: str, tree: str, branch: Optional[str],
8585
patches: Optional[List[str]] = None,
8686
patchwork_series_id: Optional[int] = None,
87-
chash: Optional[str] = None) -> str:
87+
chash: Optional[str] = None,
88+
model: Optional[str] = None) -> str:
8889
"""Submit patches for review
8990
9091
Args:
@@ -95,6 +96,7 @@ def submit_review(url: str, token: str, tree: str, branch: Optional[str],
9596
patches: List of patch contents (or None if using patchwork/hash)
9697
patchwork_series_id: Patchwork series ID (or None if using patches/hash)
9798
chash: Git hash or range (or None if using patches/patchwork)
99+
model: Optional model name (sonnet, opus, haiku)
98100
99101
Returns:
100102
Review ID
@@ -119,6 +121,9 @@ def submit_review(url: str, token: str, tree: str, branch: Optional[str],
119121
if branch:
120122
payload['branch'] = branch
121123

124+
if model:
125+
payload['model'] = model
126+
122127
try:
123128
response = requests.post(api_url, json=payload, timeout=30)
124129
response.raise_for_status()
@@ -262,11 +267,13 @@ def main():
262267
token = mytoken
263268
tree = netdev/net-next
264269
branch = main
270+
model = sonnet
265271
266272
Command-line arguments always override config file values.
267273
To unset a config value, pass an empty string:
268274
%(prog)s --token= --review-id abc-123-def # Query without token
269275
%(prog)s --branch= 0001-fix.patch # Submit without branch
276+
%(prog)s --model= 0001-fix.patch # Use default model
270277
"""
271278
)
272279

@@ -278,6 +285,8 @@ def main():
278285
help='Git tree name (e.g., netdev/net-next) [required for submission]')
279286
parser.add_argument('--branch',
280287
help='Git branch name (optional)')
288+
parser.add_argument('--model', choices=['sonnet', 'opus', 'haiku'],
289+
help='Claude model to use (optional)')
281290
parser.add_argument('--format', choices=['json', 'markup', 'inline'],
282291
default='inline',
283292
help='Review output format (default: inline)')
@@ -307,12 +316,16 @@ def main():
307316
args.tree = config.get('air', 'tree')
308317
if args.branch is None and config.has_option('air', 'branch'):
309318
args.branch = config.get('air', 'branch')
319+
if args.model is None and config.has_option('air', 'model'):
320+
args.model = config.get('air', 'model')
310321

311322
# Convert empty strings to None (allows unsetting config values)
312323
if args.token == '':
313324
args.token = None
314325
if args.branch == '':
315326
args.branch = None
327+
if args.model == '':
328+
args.model = None
316329

317330
# Validate that we have URL
318331
if not args.url:
@@ -345,17 +358,20 @@ def main():
345358
print(f"Submitting patchwork series {args.pw_series} to {args.tree}...")
346359
review_id = submit_review(args.url, args.token, args.tree,
347360
args.branch,
348-
patchwork_series_id=args.pw_series)
361+
patchwork_series_id=args.pw_series,
362+
model=args.model)
349363
elif args.hash:
350364
print(f"Submitting git hash/range {args.hash} to {args.tree}...")
351365
review_id = submit_review(args.url, args.token, args.tree,
352-
args.branch, chash=args.hash)
366+
args.branch, chash=args.hash,
367+
model=args.model)
353368
else:
354369
print(f"Reading {len(args.patches)} patch file(s)...")
355370
patches = read_patch_files(args.patches)
356371
print(f"Submitting to {args.tree}...")
357372
review_id = submit_review(args.url, args.token, args.tree,
358-
args.branch, patches=patches)
373+
args.branch, patches=patches,
374+
model=args.model)
359375

360376
print(f"Review ID: {review_id}")
361377

0 commit comments

Comments
 (0)