Home / Function/ get_output_schema() — langchain Function Reference

get_output_schema() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  deb936ea_7f0b_1e11_2a99_45dbfcf6b283["get_output_schema()"]
  f9cb8198_4568_d401_f003_82c579cfa18f["RunnableWithMessageHistory"]
  deb936ea_7f0b_1e11_2a99_45dbfcf6b283 -->|defined in| f9cb8198_4568_d401_f003_82c579cfa18f
  style deb936ea_7f0b_1e11_2a99_45dbfcf6b283 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/runnables/history.py lines 411–441

    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.
        """
        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(
            "RunnableWithChatHistoryOutput",
            root=root_type,
            module_name=self.__class__.__module__,
        )

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/history.py.
Where is get_output_schema() defined?
get_output_schema() is defined in libs/core/langchain_core/runnables/history.py at line 411.

Analyze Your Own Codebase

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

Try Supermodel Free