Home / Function/ _validate_prompt() — langchain Function Reference

_validate_prompt() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  cce673f7_e430_f7fa_92e5_59e4d3e80582["_validate_prompt()"]
  ab0b7396_014e_9570_8f95_c492a9ffc94b["base.py"]
  cce673f7_e430_f7fa_92e5_59e4d3e80582 -->|defined in| ab0b7396_014e_9570_8f95_c492a9ffc94b
  style cce673f7_e430_f7fa_92e5_59e4d3e80582 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/chains/combine_documents/base.py lines 26–32

def _validate_prompt(prompt: BasePromptTemplate, document_variable_name: str) -> None:
    if document_variable_name not in prompt.input_variables:
        msg = (
            f"Prompt must accept {document_variable_name} as an input variable. "
            f"Received prompt with input variables: {prompt.input_variables}"
        )
        raise ValueError(msg)

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/combine_documents/base.py.
Where is _validate_prompt() defined?
_validate_prompt() is defined in libs/langchain/langchain_classic/chains/combine_documents/base.py at line 26.

Analyze Your Own Codebase

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

Try Supermodel Free