Bind tool-like objects to this chat model.
Assumes model is compatible with OpenAI tool-calling API.
bind_tools(
self,
tools: Sequence[Union[Dict[str, Any], Type[BaseModel], Callable, BaseTool]],
*,
tool_choice: Optional[Union[dict, str, Literal['auto', 'none', 'required', 'any'], bool]] = None,
**kwargs: Any = {}
) -> Runnable[LanguageModelInput, AIMessage]| Name | Type | Description |
|---|---|---|
tools* | Sequence[Union[Dict[str, Any], Type[BaseModel], Callable, BaseTool]] | A list of tool definitions to bind to this chat model. Can be a dictionary, pydantic model, callable, or BaseTool. Pydantic models, callables, and BaseTools will be automatically converted to their schema dictionary representation. |
tool_choice | Optional[Union[dict, str, Literal['auto', 'none', 'required', 'any'], bool]] | Default: NoneWhich tool to require the model to call. Options are: name of the tool (str): calls corresponding tool; "auto": automatically selects a tool (including no tool); "none": model does not generate any tool calls and instead must generate a standard assistant message; "required": the model picks the most relevant tool in tools and must generate a tool call; or a dict of the form: {"type": "function", "function": {"name": <<tool_name>>}}. |
**kwargs | Any | Default: {}Any additional parameters to pass to the
:class: |