Home / Function/ _validate_prompt() — langchain Function Reference

_validate_prompt() — langchain Function Reference

Architecture documentation for the _validate_prompt() function in llm_router.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  56745521_2936_9cc1_c805_d317353974fe["_validate_prompt()"]
  6583c2eb_e73e_04a5_2dfe_d3e26b9ec1eb["LLMRouterChain"]
  56745521_2936_9cc1_c805_d317353974fe -->|defined in| 6583c2eb_e73e_04a5_2dfe_d3e26b9ec1eb
  style 56745521_2936_9cc1_c805_d317353974fe fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/chains/router/llm_router.py lines 107–117

    def _validate_prompt(self) -> Self:
        prompt = self.llm_chain.prompt
        if prompt.output_parser is None:
            msg = (
                "LLMRouterChain requires base llm_chain prompt to have an output"
                " parser that converts LLM text output to a dictionary with keys"
                " 'destination' and 'next_inputs'. Received a prompt with no output"
                " parser."
            )
            raise ValueError(msg)
        return self

Subdomains

Frequently Asked Questions

What does _validate_prompt() do?
_validate_prompt() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/chains/router/llm_router.py.
Where is _validate_prompt() defined?
_validate_prompt() is defined in libs/langchain/langchain_classic/chains/router/llm_router.py at line 107.

Analyze Your Own Codebase

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

Try Supermodel Free