Home / Function/ _validate_tools() — langchain Function Reference

_validate_tools() — langchain Function Reference

Architecture documentation for the _validate_tools() function in base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  1c25b3ee_1cc2_569b_6970_bd431e6f54ca["_validate_tools()"]
  efa737fc_e2bb_00c6_fe6e_ee6cb1f6cb6c["ZeroShotAgent"]
  1c25b3ee_1cc2_569b_6970_bd431e6f54ca -->|defined in| efa737fc_e2bb_00c6_fe6e_ee6cb1f6cb6c
  f50a836d_579d_7ed4_e51f_6bb4bd0b8059["from_llm_and_tools()"]
  f50a836d_579d_7ed4_e51f_6bb4bd0b8059 -->|calls| 1c25b3ee_1cc2_569b_6970_bd431e6f54ca
  style 1c25b3ee_1cc2_569b_6970_bd431e6f54ca fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/agents/mrkl/base.py lines 162–176

    def _validate_tools(cls, tools: Sequence[BaseTool]) -> None:
        validate_tools_single_input(cls.__name__, tools)
        if len(tools) == 0:
            msg = (
                f"Got no tools for {cls.__name__}. At least one tool must be provided."
            )
            raise ValueError(msg)
        for tool in tools:
            if tool.description is None:
                msg = (  # type: ignore[unreachable]
                    f"Got a tool {tool.name} without a description. For this agent, "
                    f"a description must always be provided."
                )
                raise ValueError(msg)
        super()._validate_tools(tools)

Subdomains

Frequently Asked Questions

What does _validate_tools() do?
_validate_tools() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/agents/mrkl/base.py.
Where is _validate_tools() defined?
_validate_tools() is defined in libs/langchain/langchain_classic/agents/mrkl/base.py at line 162.
What calls _validate_tools()?
_validate_tools() is called by 1 function(s): from_llm_and_tools.

Analyze Your Own Codebase

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

Try Supermodel Free