From e47724b1abe2f31bd8ce2e93a10dc1734b9e9dec Mon Sep 17 00:00:00 2001 From: jjallaire-aisi Date: Thu, 19 Dec 2024 10:02:15 -0500 Subject: [PATCH] don't pass parallel_tool_calls to o1 models (#1025) Co-authored-by: J.J. Allaire --- src/inspect_ai/model/_providers/openai.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/inspect_ai/model/_providers/openai.py b/src/inspect_ai/model/_providers/openai.py index 7c2ed5536..5f2b06110 100644 --- a/src/inspect_ai/model/_providers/openai.py +++ b/src/inspect_ai/model/_providers/openai.py @@ -142,12 +142,11 @@ def __init__( **model_args, ) + def is_o1(self) -> bool: + return self.model_name.startswith("o1") + def is_o1_full(self) -> bool: - return ( - self.model_name.startswith("o1") - and not self.is_o1_mini() - and not self.is_o1_preview() - ) + return self.is_o1() and not self.is_o1_mini() and not self.is_o1_preview() def is_o1_mini(self) -> bool: return self.model_name.startswith("o1-mini") @@ -285,7 +284,7 @@ def completion_params(self, config: GenerateConfig, tools: bool) -> dict[str, An params["logprobs"] = config.logprobs if config.top_logprobs is not None: params["top_logprobs"] = config.top_logprobs - if tools and config.parallel_tool_calls is not None: + if tools and config.parallel_tool_calls is not None and not self.is_o1(): params["parallel_tool_calls"] = config.parallel_tool_calls if config.reasoning_effort is not None and self.is_o1_full(): params["reasoning_effort"] = config.reasoning_effort