Skip to content

Commit 923a354

Browse files
authored
Fix parallel_tool_calls when False (#333)
Currently, when we set `parallel_tool_calls=False` in the `model_settings`, the responses API is called with `parallel_tool_calls == NotGiven`, which defaults to true on the Response API side (https://platform.openai.com/docs/api-reference/responses/create#responses-create-parallel_tool_calls). This PR attempts to fix that. ``` agent = Agent( ..., model_settings=ModelSettings( parallel_tool_calls=False, ), ) ```
2 parents 927a29c + 326ff09 commit 923a354

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/agents/models/openai_responses.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,9 @@ async def _fetch_response(
208208
list_input = ItemHelpers.input_to_new_input_list(input)
209209

210210
parallel_tool_calls = (
211-
True if model_settings.parallel_tool_calls and tools and len(tools) > 0 else NOT_GIVEN
211+
True if model_settings.parallel_tool_calls and tools and len(tools) > 0
212+
else False if model_settings.parallel_tool_calls is False
213+
else NOT_GIVEN
212214
)
213215

214216
tool_choice = Converter.convert_tool_choice(model_settings.tool_choice)

0 commit comments

Comments
 (0)