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
  46289c41_3f5e_312b_c9fb_76857722ca25["_validate_tools()"]
  f0511fe2_9275_28de_22f0_35e3fb0e4ae2["SelfAskWithSearchAgent"]
  46289c41_3f5e_312b_c9fb_76857722ca25 -->|defined in| f0511fe2_9275_28de_22f0_35e3fb0e4ae2
  style 46289c41_3f5e_312b_c9fb_76857722ca25 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/agents/self_ask_with_search/base.py lines 54–63

    def _validate_tools(cls, tools: Sequence[BaseTool]) -> None:
        validate_tools_single_input(cls.__name__, tools)
        super()._validate_tools(tools)
        if len(tools) != 1:
            msg = f"Exactly one tool must be specified, but got {tools}"
            raise ValueError(msg)
        tool_names = {tool.name for tool in tools}
        if tool_names != {"Intermediate Answer"}:
            msg = f"Tool name should be Intermediate Answer, got {tool_names}"
            raise ValueError(msg)

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/self_ask_with_search/base.py.
Where is _validate_tools() defined?
_validate_tools() is defined in libs/langchain/langchain_classic/agents/self_ask_with_search/base.py at line 54.

Analyze Your Own Codebase

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

Try Supermodel Free