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.

Function python LangChainCore Runnables calls 2 called by 1

Entity Profile

Dependency Diagram

graph TD
  faf9f914_2571_c802_8b6f_3c1dbc8bcacd["get_input_schema()"]
  17599172_8889_afc6_2237_4429f3439071["RunnableParallel"]
  faf9f914_2571_c802_8b6f_3c1dbc8bcacd -->|defined in| 17599172_8889_afc6_2237_4429f3439071
  dd68934b_b24b_922a_dfc2_d96ad2d88349["get_graph()"]
  dd68934b_b24b_922a_dfc2_d96ad2d88349 -->|calls| faf9f914_2571_c802_8b6f_3c1dbc8bcacd
  432a5d2e_5b75_7d42_3ab9_d76375f00ff9["get_name()"]
  faf9f914_2571_c802_8b6f_3c1dbc8bcacd -->|calls| 432a5d2e_5b75_7d42_3ab9_d76375f00ff9
  255c479b_b9fa_44d8_4de5_2562051e06b5["get_name()"]
  faf9f914_2571_c802_8b6f_3c1dbc8bcacd -->|calls| 255c479b_b9fa_44d8_4de5_2562051e06b5
  style faf9f914_2571_c802_8b6f_3c1dbc8bcacd fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/runnables/base.py lines 3723–3755

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

        Args:
            config: The config to use.

        Returns:
            The input schema of the `Runnable`.

        """
        if all(
            s.get_input_schema(config).model_json_schema().get("type", "object")
            == "object"
            for s in self.steps__.values()
        ):
            for step in self.steps__.values():
                fields = step.get_input_schema(config).model_fields
                root_field = fields.get("root")
                if root_field is not None and root_field.annotation != Any:
                    return super().get_input_schema(config)

            # This is correct, but pydantic typings/mypy don't think so.
            return create_model_v2(
                self.get_name("Input"),
                field_definitions={
                    k: (v.annotation, v.default)
                    for step in self.steps__.values()
                    for k, v in step.get_input_schema(config).model_fields.items()
                    if k != "__root__"
                },
            )

        return super().get_input_schema(config)

Domain

Subdomains

Called By

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/runnables/base.py.
Where is get_input_schema() defined?
get_input_schema() is defined in libs/core/langchain_core/runnables/base.py at line 3723.
What does get_input_schema() call?
get_input_schema() calls 2 function(s): get_name, get_name.
What calls get_input_schema()?
get_input_schema() is called by 1 function(s): get_graph.

Analyze Your Own Codebase

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

Try Supermodel Free