config_schema() — langchain Function Reference
Architecture documentation for the config_schema() function in base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 4c94bc77_e853_aa1c_d3c6_4a29151af3df["config_schema()"] 4a62481c_02cb_a5de_1833_50669d5351a6["Runnable"] 4c94bc77_e853_aa1c_d3c6_4a29151af3df -->|defined in| 4a62481c_02cb_a5de_1833_50669d5351a6 1258d561_7a56_761f_a8ae_cdd373ea7cb1["get_config_jsonschema()"] 1258d561_7a56_761f_a8ae_cdd373ea7cb1 -->|calls| 4c94bc77_e853_aa1c_d3c6_4a29151af3df 255c479b_b9fa_44d8_4de5_2562051e06b5["get_name()"] 4c94bc77_e853_aa1c_d3c6_4a29151af3df -->|calls| 255c479b_b9fa_44d8_4de5_2562051e06b5 style 4c94bc77_e853_aa1c_d3c6_4a29151af3df fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/runnables/base.py lines 525–566
def config_schema(self, *, include: Sequence[str] | None = None) -> type[BaseModel]:
"""The type of config this `Runnable` accepts specified as a Pydantic model.
To mark a field as configurable, see the `configurable_fields`
and `configurable_alternatives` methods.
Args:
include: A list of fields to include in the config schema.
Returns:
A Pydantic model that can be used to validate config.
"""
include = include or []
config_specs = self.config_specs
configurable = (
create_model_v2(
"Configurable",
field_definitions={
spec.id: (
spec.annotation,
Field(
spec.default, title=spec.name, description=spec.description
),
)
for spec in config_specs
},
)
if config_specs
else None
)
# Many need to create a typed dict instead to implement NotRequired!
all_fields = {
**({"configurable": (configurable, None)} if configurable else {}),
**{
field_name: (field_type, None)
for field_name, field_type in get_type_hints(RunnableConfig).items()
if field_name in [i for i in include if i != "configurable"]
},
}
return create_model_v2(self.get_name("Config"), field_definitions=all_fields)
Domain
Subdomains
Defined In
Calls
Called By
Source
Frequently Asked Questions
What does config_schema() do?
config_schema() is a function in the langchain codebase, defined in libs/core/langchain_core/runnables/base.py.
Where is config_schema() defined?
config_schema() is defined in libs/core/langchain_core/runnables/base.py at line 525.
What does config_schema() call?
config_schema() calls 1 function(s): get_name.
What calls config_schema()?
config_schema() is called by 1 function(s): get_config_jsonschema.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free