Skip to content

Commit

Permalink
[chore]: tool_choice added
Browse files Browse the repository at this point in the history
  • Loading branch information
keenborder786 committed Dec 20, 2024
1 parent fcba567 commit f921ade
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,9 @@ def bind_tools(
self,
tools: Sequence[Union[Dict[str, Any], Type, Callable, BaseTool]],
*,
tool_choice: Optional[Union[dict, str, Literal["auto", "none"], bool]] = None,
tool_choice: Optional[
Union[dict, str, Literal["auto", "none", "required"], bool]
] = None,
**kwargs: Any,
) -> Runnable[LanguageModelInput, BaseMessage]:
"""Bind tool-like objects to this chat model.
Expand Down Expand Up @@ -502,7 +504,7 @@ def bind_tools(
f"tool. Received {len(formatted_tools)} tools."
)
if isinstance(tool_choice, str):
if tool_choice not in ("auto", "none"):
if tool_choice not in ("auto", "none", "required"):
tool_choice = {
"type": "function",
"function": {"name": tool_choice},
Expand Down

0 comments on commit f921ade

Please sign in to comment.