Fix and Document parallel_tool_calls
Attribute in ModelSettings
#763
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #762
Description
This PR updates the docstring for the
parallel_tool_calls
attribute in theModelSettings
dataclass. The previous docstring incorrectly stated that the default value isFalse
, while the actual default isTrue
.In OpenAI docs of section Function Calling, it is clearly mentioned that "The model may choose to call multiple functions in a single turn. You can prevent this by setting
parallel_tool_calls
tofalse
, which ensures exactly zero or one tool is called."Therefore, if the
parallel_tool_calls
attribute in theModelSettings
dataclass is set toNone
(i.e.,parallel_tool_calls: bool | None = None
), and this value is passed directly to the API without modification, it effectively behaves as ifparallel_tool_calls
is set toTrue
.The new docstring is formatted for automatic documentation generation and provides clear, accurate information for users and developers.
Key changes:
parallel_tool_calls
fromFalse
toTrue
.parallel_tool_calls
attribute.Testing:
parallel_tool_calls=False
in both therun_config
of theRunner.run
method and in the agent’smodel_settings
attribute.Runner.run
:parallel_tool_calls=False
, tools are called sequentially.Why this is important:
parallel_tool_calls
.