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 08435009_1486_e4f9_5312_91db7c8545a0["get_input_schema()"] 4a62481c_02cb_a5de_1833_50669d5351a6["Runnable"] 08435009_1486_e4f9_5312_91db7c8545a0 -->|defined in| 4a62481c_02cb_a5de_1833_50669d5351a6 9f10c40d_1a35_2bbe_f0f3_ade9a50ddf54["input_schema()"] 9f10c40d_1a35_2bbe_f0f3_ade9a50ddf54 -->|calls| 08435009_1486_e4f9_5312_91db7c8545a0 bb994673_65a8_b98b_ca59_66e1a04c78a4["get_input_jsonschema()"] bb994673_65a8_b98b_ca59_66e1a04c78a4 -->|calls| 08435009_1486_e4f9_5312_91db7c8545a0 0d15d94e_1356_d663_2931_94fce971d5bd["get_graph()"] 0d15d94e_1356_d663_2931_94fce971d5bd -->|calls| 08435009_1486_e4f9_5312_91db7c8545a0 255c479b_b9fa_44d8_4de5_2562051e06b5["get_name()"] 08435009_1486_e4f9_5312_91db7c8545a0 -->|calls| 255c479b_b9fa_44d8_4de5_2562051e06b5 style 08435009_1486_e4f9_5312_91db7c8545a0 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/runnables/base.py lines 370–409
def get_input_schema(
self,
config: RunnableConfig | None = None,
) -> type[BaseModel]:
"""Get a Pydantic model that can be used to validate input to the `Runnable`.
`Runnable` objects that leverage the `configurable_fields` and
`configurable_alternatives` methods will have a dynamic input schema that
depends on which configuration the `Runnable` is invoked with.
This method allows to get an input schema for a specific configuration.
Args:
config: A config to use when generating the schema.
Returns:
A Pydantic model that can be used to validate input.
"""
_ = config
root_type = self.InputType
if (
inspect.isclass(root_type)
and not isinstance(root_type, GenericAlias)
and issubclass(root_type, BaseModel)
):
return root_type
return create_model_v2(
self.get_name("Input"),
root=root_type,
# create model needs access to appropriate type annotations to be
# able to construct the Pydantic model.
# When we create the model, we pass information about the namespace
# where the model is being created, so the type annotations can
# be resolved correctly as well.
# self.__class__.__module__ handles the case when the Runnable is
# being sub-classed in a different module.
module_name=self.__class__.__module__,
)
Domain
Subdomains
Defined In
Calls
Source
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 370.
What does get_input_schema() call?
get_input_schema() calls 1 function(s): get_name.
What calls get_input_schema()?
get_input_schema() is called by 3 function(s): get_graph, get_input_jsonschema, input_schema.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free