Home / Function/ get_input_schema() — langchain Function Reference

get_input_schema() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  fccdd4c7_614e_f914_5cb4_a1d21fc06c86["get_input_schema()"]
  dddce6a3_2420_c71d_01fe_f214c3eb2503["BasePromptTemplate"]
  fccdd4c7_614e_f914_5cb4_a1d21fc06c86 -->|defined in| dddce6a3_2420_c71d_01fe_f214c3eb2503
  style fccdd4c7_614e_f914_5cb4_a1d21fc06c86 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/prompts/base.py lines 138–157

    def get_input_schema(self, config: RunnableConfig | None = None) -> type[BaseModel]:
        """Get the input schema for the prompt.

        Args:
            config: Configuration for the prompt.

        Returns:
            The input schema for the prompt.
        """
        # This is correct, but pydantic typings/mypy don't think so.
        required_input_variables = {
            k: (self.input_types.get(k, str), ...) for k in self.input_variables
        }
        optional_input_variables = {
            k: (self.input_types.get(k, str), None) for k in self.optional_variables
        }
        return create_model_v2(
            "PromptInput",
            field_definitions={**required_input_variables, **optional_input_variables},
        )

Subdomains

Frequently Asked Questions

What does get_input_schema() do?
get_input_schema() is a function in the langchain codebase, defined in libs/core/langchain_core/prompts/base.py.
Where is get_input_schema() defined?
get_input_schema() is defined in libs/core/langchain_core/prompts/base.py at line 138.

Analyze Your Own Codebase

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

Try Supermodel Free