mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-11 22:04:37 +00:00
openai[patch]: make parallel_tool_calls explicit kwarg of bind_tools (#29669)
Improves discoverability and documentation. cc @vbarda
This commit is contained in:
parent
2a243df7bb
commit
92e2239414
@ -1183,6 +1183,7 @@ class BaseChatOpenAI(BaseChatModel):
|
|||||||
Union[dict, str, Literal["auto", "none", "required", "any"], bool]
|
Union[dict, str, Literal["auto", "none", "required", "any"], bool]
|
||||||
] = None,
|
] = None,
|
||||||
strict: Optional[bool] = None,
|
strict: Optional[bool] = None,
|
||||||
|
parallel_tool_calls: Optional[bool] = None,
|
||||||
**kwargs: Any,
|
**kwargs: Any,
|
||||||
) -> Runnable[LanguageModelInput, BaseMessage]:
|
) -> Runnable[LanguageModelInput, BaseMessage]:
|
||||||
"""Bind tool-like objects to this chat model.
|
"""Bind tool-like objects to this chat model.
|
||||||
@ -1208,6 +1209,8 @@ class BaseChatOpenAI(BaseChatModel):
|
|||||||
If False, input schema will not be validated and model output will not
|
If False, input schema will not be validated and model output will not
|
||||||
be validated.
|
be validated.
|
||||||
If None, ``strict`` argument will not be passed to the model.
|
If None, ``strict`` argument will not be passed to the model.
|
||||||
|
parallel_tool_calls: Set to ``False`` to disable parallel tool use.
|
||||||
|
Defaults to ``None`` (no specification, which allows parallel tool use).
|
||||||
kwargs: Any additional parameters are passed directly to
|
kwargs: Any additional parameters are passed directly to
|
||||||
:meth:`~langchain_openai.chat_models.base.ChatOpenAI.bind`.
|
:meth:`~langchain_openai.chat_models.base.ChatOpenAI.bind`.
|
||||||
|
|
||||||
@ -1217,6 +1220,8 @@ class BaseChatOpenAI(BaseChatModel):
|
|||||||
|
|
||||||
""" # noqa: E501
|
""" # noqa: E501
|
||||||
|
|
||||||
|
if parallel_tool_calls is not None:
|
||||||
|
kwargs["parallel_tool_calls"] = parallel_tool_calls
|
||||||
formatted_tools = [
|
formatted_tools = [
|
||||||
convert_to_openai_tool(tool, strict=strict) for tool in tools
|
convert_to_openai_tool(tool, strict=strict) for tool in tools
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user