Home / Function/ get_output_schema() — langchain Function Reference

get_output_schema() — langchain Function Reference

Architecture documentation for the get_output_schema() function in passthrough.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  eb34dd0d_547a_c34d_714b_0e5988d02d4a["get_output_schema()"]
  e893b6ae_1c28_41f1_aa8b_a66d0f779312["RunnableAssign"]
  eb34dd0d_547a_c34d_714b_0e5988d02d4a -->|defined in| e893b6ae_1c28_41f1_aa8b_a66d0f779312
  19a9f612_029a_748a_531c_4fc5b8ba37bd["get_input_schema()"]
  eb34dd0d_547a_c34d_714b_0e5988d02d4a -->|calls| 19a9f612_029a_748a_531c_4fc5b8ba37bd
  style eb34dd0d_547a_c34d_714b_0e5988d02d4a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/runnables/passthrough.py lines 438–460

    def get_output_schema(
        self, config: RunnableConfig | None = None
    ) -> type[BaseModel]:
        map_input_schema = self.mapper.get_input_schema(config)
        map_output_schema = self.mapper.get_output_schema(config)
        if not issubclass(map_input_schema, RootModel) and not issubclass(
            map_output_schema, RootModel
        ):
            fields = {}

            for name, field_info in map_input_schema.model_fields.items():
                fields[name] = (field_info.annotation, field_info.default)

            for name, field_info in map_output_schema.model_fields.items():
                fields[name] = (field_info.annotation, field_info.default)

            return create_model_v2("RunnableAssignOutput", field_definitions=fields)
        if not issubclass(map_output_schema, RootModel):
            # ie. only map output is a dict
            # ie. input type is either unknown or inferred incorrectly
            return map_output_schema

        return super().get_output_schema(config)

Domain

Subdomains

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/passthrough.py.
Where is get_output_schema() defined?
get_output_schema() is defined in libs/core/langchain_core/runnables/passthrough.py at line 438.
What does get_output_schema() call?
get_output_schema() calls 1 function(s): get_input_schema.

Analyze Your Own Codebase

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

Try Supermodel Free