Skip to content

Commit c7e3c35

Browse files
CosmicGansCosmicGans
andauthored
handle o-series (#36)
Co-authored-by: CosmicGans <max@metr.com>
1 parent 5bcf9bb commit c7e3c35

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎src/triframe_inspect/util/choices.py‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ async def generate_choices(
1515
settings: TriframeSettings,
1616
desired_choices: int = 3,
1717
) -> List[ModelOutput]:
18-
"""Generate multiple model responses, handling Anthropic models specially.
18+
"""Generate multiple model responses, handling Anthropic and OAI reasoning models specially.
1919
2020
Args:
2121
model: The model to use for generation
@@ -28,9 +28,11 @@ async def generate_choices(
2828
List of ModelOutput objects containing all generated results
2929
"""
3030
is_anthropic = model.name.startswith("claude")
31+
is_o_series = model.name.startswith("o3") or model.name.startswith("o1")
3132

32-
if is_anthropic:
33-
# For Anthropic, make multiple single-choice requests
33+
if is_anthropic or is_o_series:
34+
# For Anthropic and o-series models, make multiple single-choice requests
35+
# o-series models use Responses API which doesn't support num_choices
3436
config = GenerateConfig(
3537
**{k: v for k, v in settings.items() if k != "num_choices"}
3638
)
@@ -40,7 +42,7 @@ async def generate_choices(
4042
]
4143
return await asyncio.gather(*requests)
4244

43-
# For non-Anthropic models, use num_choices parameter
45+
# For other models, use num_choices parameter
4446
config = GenerateConfig(**{**settings, "num_choices": desired_choices})
4547
result = await model.generate(input=messages, tools=tools, config=config)
4648
return [result]

0 commit comments

Comments
 (0)