Home / Function/ with_structured_output() — langchain Function Reference

with_structured_output() — langchain Function Reference

Architecture documentation for the with_structured_output() function in base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  d86a7481_8922_e18b_7819_39cb605334fa["with_structured_output()"]
  f5a29046_740d_1358_3615_8cc689b26ca9["BaseLanguageModel"]
  d86a7481_8922_e18b_7819_39cb605334fa -->|defined in| f5a29046_740d_1358_3615_8cc689b26ca9
  style d86a7481_8922_e18b_7819_39cb605334fa fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/language_models/base.py lines 294–300

    def with_structured_output(
        self, schema: dict | type, **kwargs: Any
    ) -> Runnable[LanguageModelInput, dict | BaseModel]:
        """Not implemented on this class."""
        # Implement this on child class if there is a way of steering the model to
        # generate responses that match a given schema.
        raise NotImplementedError

Domain

Subdomains

Frequently Asked Questions

What does with_structured_output() do?
with_structured_output() is a function in the langchain codebase, defined in libs/core/langchain_core/language_models/base.py.
Where is with_structured_output() defined?
with_structured_output() is defined in libs/core/langchain_core/language_models/base.py at line 294.

Analyze Your Own Codebase

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

Try Supermodel Free