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.

Function python LangChainCore Runnables calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  1ca1316b_add2_5905_2c2a_ffd20e4c42c7["get_output_schema()"]
  c6a370e4_a02a_c56a_38eb_7ca734dcbfea["RunnableLambda"]
  1ca1316b_add2_5905_2c2a_ffd20e4c42c7 -->|defined in| c6a370e4_a02a_c56a_38eb_7ca734dcbfea
  4b92cace_dc70_6808_9c96_2880d0125ea4["get_graph()"]
  4b92cace_dc70_6808_9c96_2880d0125ea4 -->|calls| 1ca1316b_add2_5905_2c2a_ffd20e4c42c7
  255c479b_b9fa_44d8_4de5_2562051e06b5["get_name()"]
  1ca1316b_add2_5905_2c2a_ffd20e4c42c7 -->|calls| 255c479b_b9fa_44d8_4de5_2562051e06b5
  style 1ca1316b_add2_5905_2c2a_ffd20e4c42c7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/runnables/base.py lines 4737–4761

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

Called By

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 4737.
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 1 function(s): get_graph.

Analyze Your Own Codebase

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

Try Supermodel Free