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
  0558a8d1_8354_9c26_3820_59b579b5eb8d["validate_prompt()"]
  93ed7b23_f0e4_5732_b3ed_dccef0049b97["OpenAIFunctionsAgent"]
  0558a8d1_8354_9c26_3820_59b579b5eb8d -->|defined in| 93ed7b23_f0e4_5732_b3ed_dccef0049b97
  style 0558a8d1_8354_9c26_3820_59b579b5eb8d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/agents/openai_functions_agent/base.py lines 65–84

    def validate_prompt(self) -> Self:
        """Validate prompt.

        Args:
            values: Values to validate.

        Returns:
            Validated values.

        Raises:
            ValueError: If `agent_scratchpad` is not in the prompt.
        """
        prompt: BasePromptTemplate = self.prompt
        if "agent_scratchpad" not in prompt.input_variables:
            msg = (
                "`agent_scratchpad` should be one of the variables in the prompt, "
                f"got {prompt.input_variables}"
            )
            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/agents/openai_functions_agent/base.py.
Where is validate_prompt() defined?
validate_prompt() is defined in libs/langchain/langchain_classic/agents/openai_functions_agent/base.py at line 65.

Analyze Your Own Codebase

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

Try Supermodel Free