From a54471a6e193087538694014f5d4e1533ab0e4fa Mon Sep 17 00:00:00 2001 From: RonaldChungHueyWu <10584547+ronaldchwu@users.noreply.github.com> Date: Tue, 15 Apr 2025 12:11:18 +1000 Subject: [PATCH] Support parallel_tool_calls=False for ChatCompletion API --- src/agents/models/openai_chatcompletions.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/agents/models/openai_chatcompletions.py b/src/agents/models/openai_chatcompletions.py index c12fe68a..712a7998 100644 --- a/src/agents/models/openai_chatcompletions.py +++ b/src/agents/models/openai_chatcompletions.py @@ -500,7 +500,11 @@ async def _fetch_response( span.span_data.input = converted_messages parallel_tool_calls = ( - True if model_settings.parallel_tool_calls and tools and len(tools) > 0 else NOT_GIVEN + True + if model_settings.parallel_tool_calls and tools and len(tools) > 0 + else False + if model_settings.parallel_tool_calls is False + else NOT_GIVEN ) tool_choice = _Converter.convert_tool_choice(model_settings.tool_choice) response_format = _Converter.convert_response_format(output_schema)