Home / Function/ get_output_schema() — langchain Function Reference

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
  9677d39c_6542_42c3_bbb2_269c14a3adc9["get_output_schema()"]
  8e601be2_5eac_8426_f30d_f1ed37138bd8["RunnableGenerator"]
  9677d39c_6542_42c3_bbb2_269c14a3adc9 -->|defined in| 8e601be2_5eac_8426_f30d_f1ed37138bd8
  255c479b_b9fa_44d8_4de5_2562051e06b5["get_name()"]
  9677d39c_6542_42c3_bbb2_269c14a3adc9 -->|calls| 255c479b_b9fa_44d8_4de5_2562051e06b5
  style 9677d39c_6542_42c3_bbb2_269c14a3adc9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/runnables/base.py lines 4284–4308

    def get_output_schema(
        self, config: RunnableConfig | None = None
    ) -> type[BaseModel]:
        # Override the default implementation.
        # For a runnable generator, we need to bring to provide the
        # module of the underlying function when creating the model.
        root_type = self.OutputType
        func = getattr(self, "_transform", None) or self._atransform
        module = getattr(func, "__module__", None)

        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,
            # To create the schema, we need to provide the module
            # where the underlying function is defined.
            # This allows pydantic to resolve type annotations appropriately.
            module_name=module,
        )

Domain

Subdomains

Calls

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 4284.
What does get_output_schema() call?
get_output_schema() calls 1 function(s): get_name.

Analyze Your Own Codebase

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

Try Supermodel Free