bind_tools() — langchain Function Reference
Architecture documentation for the bind_tools() function in chat_models.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 545f16bd_426f_c50e_470a_f45133e1a080["bind_tools()"] f3181e26_0568_4993_612c_5b8d73ad3c37["ChatDeepSeek"] 545f16bd_426f_c50e_470a_f45133e1a080 -->|defined in| f3181e26_0568_4993_612c_5b8d73ad3c37 style 545f16bd_426f_c50e_470a_f45133e1a080 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/deepseek/langchain_deepseek/chat_models.py lines 395–437
def bind_tools(
self,
tools: Sequence[dict[str, Any] | type | Callable | BaseTool],
*,
tool_choice: dict | str | bool | None = None,
strict: bool | None = None,
parallel_tool_calls: bool | None = None,
**kwargs: Any,
) -> Runnable[LanguageModelInput, AIMessage]:
"""Bind tool-like objects to this chat model.
Overrides parent to use beta endpoint when `strict=True`.
Args:
tools: A list of tool definitions to bind to this chat model.
tool_choice: Which tool to require the model to call.
strict: If True, uses beta API for strict schema validation.
parallel_tool_calls: Set to `False` to disable parallel tool use.
**kwargs: Additional parameters passed to parent `bind_tools`.
Returns:
A Runnable that takes same inputs as a chat model.
"""
# If strict mode is enabled and using default API base, switch to beta endpoint
if strict is True and self.api_base == DEFAULT_API_BASE:
# Create a new instance with beta endpoint
beta_model = self.model_copy(update={"api_base": DEFAULT_BETA_API_BASE})
return beta_model.bind_tools(
tools,
tool_choice=tool_choice,
strict=strict,
parallel_tool_calls=parallel_tool_calls,
**kwargs,
)
# Otherwise use parent implementation
return super().bind_tools(
tools,
tool_choice=tool_choice,
strict=strict,
parallel_tool_calls=parallel_tool_calls,
**kwargs,
)
Domain
Subdomains
Source
Frequently Asked Questions
What does bind_tools() do?
bind_tools() is a function in the langchain codebase, defined in libs/partners/deepseek/langchain_deepseek/chat_models.py.
Where is bind_tools() defined?
bind_tools() is defined in libs/partners/deepseek/langchain_deepseek/chat_models.py at line 395.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free