Home / Function/ structured_output_kwargs() — langchain Function Reference

structured_output_kwargs() — langchain Function Reference

Architecture documentation for the structured_output_kwargs() function in chat_models.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  cb895d7a_be98_3ea2_e360_39a261b5c261["structured_output_kwargs()"]
  93a85b25_a139_159d_bcf5_03a6e2ed4dd3["ChatModelTests"]
  cb895d7a_be98_3ea2_e360_39a261b5c261 -->|defined in| 93a85b25_a139_159d_bcf5_03a6e2ed4dd3
  style cb895d7a_be98_3ea2_e360_39a261b5c261 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/standard-tests/langchain_tests/unit_tests/chat_models.py lines 115–137

    def structured_output_kwargs(self) -> dict[str, Any]:
        """Additional kwargs to pass to `with_structured_output()` in tests.

        Override this property to customize how structured output is generated
        for your model. The most common use case is specifying the `method`
        parameter, which controls the mechanism used to enforce structured output:

        - `'function_calling'`: Uses tool/function calling to enforce the schema.
        - `'json_mode'`: Uses the model's JSON mode.
        - `'json_schema'`: Uses native JSON schema support (e.g., OpenAI's
            structured outputs).

        Returns:
            A dict of kwargs passed to `with_structured_output()`.

        Example:
            ```python
            @property
            def structured_output_kwargs(self) -> dict:
                return {"method": "json_schema"}
            ```
        """
        return {}

Domain

Subdomains

Frequently Asked Questions

What does structured_output_kwargs() do?
structured_output_kwargs() is a function in the langchain codebase, defined in libs/standard-tests/langchain_tests/unit_tests/chat_models.py.
Where is structured_output_kwargs() defined?
structured_output_kwargs() is defined in libs/standard-tests/langchain_tests/unit_tests/chat_models.py at line 115.

Analyze Your Own Codebase

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

Try Supermodel Free