Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b978b43

Browse filesBrowse files
authored
Support parallel_tool_calls=False for ChatCompletion API (openai#513)
The current ChatCompletion API supports only `parallel_tool_calls=True` or `parallel_tool_calls=NOT_GIVEN` This PR is to support setting `parallel_tool_calls=False`, a common requirement in controlling agent tool use patterns (e.g. ensuring one tool call at the time, to facilitate desired tool calling sequence). I followed the merged [PR#333](openai#333) for consistency.
1 parent 96a97af commit b978b43
Copy full SHA for b978b43

File tree

Expand file treeCollapse file tree

1 file changed

+5
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-1
lines changed

‎src/agents/models/openai_chatcompletions.py

Copy file name to clipboardExpand all lines: src/agents/models/openai_chatcompletions.py
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,11 @@ async def _fetch_response(
500500
span.span_data.input = converted_messages
501501

502502
parallel_tool_calls = (
503-
True if model_settings.parallel_tool_calls and tools and len(tools) > 0 else NOT_GIVEN
503+
True
504+
if model_settings.parallel_tool_calls and tools and len(tools) > 0
505+
else False
506+
if model_settings.parallel_tool_calls is False
507+
else NOT_GIVEN
504508
)
505509
tool_choice = _Converter.convert_tool_choice(model_settings.tool_choice)
506510
response_format = _Converter.convert_response_format(output_schema)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.