Home / Function/ bind_tools() — langchain Function Reference

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
  f691aa13_25a5_eecf_5188_77aeb1ac77c2["bind_tools()"]
  48aa29b8_65e7_522f_a445_a441eeb6baff["BaseChatModel"]
  f691aa13_25a5_eecf_5188_77aeb1ac77c2 -->|defined in| 48aa29b8_65e7_522f_a445_a441eeb6baff
  a7b3568d_42f9_a0cb_ee98_bd7da412e7e8["with_structured_output()"]
  a7b3568d_42f9_a0cb_ee98_bd7da412e7e8 -->|calls| f691aa13_25a5_eecf_5188_77aeb1ac77c2
  style f691aa13_25a5_eecf_5188_77aeb1ac77c2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/language_models/chat_models.py lines 1521–1538

    def bind_tools(
        self,
        tools: Sequence[builtins.dict[str, Any] | type | Callable | BaseTool],
        *,
        tool_choice: str | None = None,
        **kwargs: Any,
    ) -> Runnable[LanguageModelInput, AIMessage]:
        """Bind tools to the model.

        Args:
            tools: Sequence of tools to bind to the model.
            tool_choice: The tool to use. If "any" then any tool can be used.

        Returns:
            A Runnable that returns a message.

        """
        raise NotImplementedError

Domain

Subdomains

Frequently Asked Questions

What does bind_tools() do?
bind_tools() is a function in the langchain codebase, defined in libs/core/langchain_core/language_models/chat_models.py.
Where is bind_tools() defined?
bind_tools() is defined in libs/core/langchain_core/language_models/chat_models.py at line 1521.
What calls bind_tools()?
bind_tools() is called by 1 function(s): with_structured_output.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free