Home / Function/ test_schema_from_with_structured_output() — langchain Function Reference

test_schema_from_with_structured_output() — langchain Function Reference

Architecture documentation for the test_schema_from_with_structured_output() function in test_base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  6ca23708_a5f6_cabd_4f0b_4b23df00b6f1["test_schema_from_with_structured_output()"]
  48232d20_f8c1_b597_14fa_7dc407e9bfe5["test_base.py"]
  6ca23708_a5f6_cabd_4f0b_4b23df00b6f1 -->|defined in| 48232d20_f8c1_b597_14fa_7dc407e9bfe5
  style 6ca23708_a5f6_cabd_4f0b_4b23df00b6f1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/openai/tests/unit_tests/chat_models/test_base.py lines 1049–1065

def test_schema_from_with_structured_output(schema: type) -> None:
    """Test schema from with_structured_output."""

    llm = ChatOpenAI(model="gpt-4o")

    structured_llm = llm.with_structured_output(
        schema, method="json_schema", strict=True
    )

    expected = {
        "properties": {"bar": {"title": "Bar", "type": "integer"}},
        "required": ["bar"],
        "title": schema.__name__,
        "type": "object",
    }
    actual = structured_llm.get_output_schema().model_json_schema()
    assert actual == expected

Domain

Subdomains

Frequently Asked Questions

What does test_schema_from_with_structured_output() do?
test_schema_from_with_structured_output() is a function in the langchain codebase, defined in libs/partners/openai/tests/unit_tests/chat_models/test_base.py.
Where is test_schema_from_with_structured_output() defined?
test_schema_from_with_structured_output() is defined in libs/partners/openai/tests/unit_tests/chat_models/test_base.py at line 1049.

Analyze Your Own Codebase

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

Try Supermodel Free