get_output_schema() — langchain Function Reference
Architecture documentation for the get_output_schema() function in base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 310f6e6e_dbfb_7eb4_3854_6fc149d866c4["get_output_schema()"] 4a62481c_02cb_a5de_1833_50669d5351a6["Runnable"] 310f6e6e_dbfb_7eb4_3854_6fc149d866c4 -->|defined in| 4a62481c_02cb_a5de_1833_50669d5351a6 2eabe43f_03db_eedf_6d6e_6318694eaef4["output_schema()"] 2eabe43f_03db_eedf_6d6e_6318694eaef4 -->|calls| 310f6e6e_dbfb_7eb4_3854_6fc149d866c4 37fd13d7_34ce_8eed_97e7_c56543c90e6c["get_output_jsonschema()"] 37fd13d7_34ce_8eed_97e7_c56543c90e6c -->|calls| 310f6e6e_dbfb_7eb4_3854_6fc149d866c4 0d15d94e_1356_d663_2931_94fce971d5bd["get_graph()"] 0d15d94e_1356_d663_2931_94fce971d5bd -->|calls| 310f6e6e_dbfb_7eb4_3854_6fc149d866c4 255c479b_b9fa_44d8_4de5_2562051e06b5["get_name()"] 310f6e6e_dbfb_7eb4_3854_6fc149d866c4 -->|calls| 255c479b_b9fa_44d8_4de5_2562051e06b5 style 310f6e6e_dbfb_7eb4_3854_6fc149d866c4 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/runnables/base.py lines 449–488
def get_output_schema(
self,
config: RunnableConfig | None = None,
) -> type[BaseModel]:
"""Get a Pydantic model that can be used to validate output to the `Runnable`.
`Runnable` objects that leverage the `configurable_fields` and
`configurable_alternatives` methods will have a dynamic output schema that
depends on which configuration the `Runnable` is invoked with.
This method allows to get an output 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 output.
"""
_ = config
root_type = self.OutputType
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("Output"),
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_output_schema() do?
get_output_schema() is a function in the langchain codebase, defined in libs/core/langchain_core/runnables/base.py.
Where is get_output_schema() defined?
get_output_schema() is defined in libs/core/langchain_core/runnables/base.py at line 449.
What does get_output_schema() call?
get_output_schema() calls 1 function(s): get_name.
What calls get_output_schema()?
get_output_schema() is called by 3 function(s): get_graph, get_output_jsonschema, output_schema.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free