Home / Function/ test_parsed_dict_schema() — langchain Function Reference

test_parsed_dict_schema() — langchain Function Reference

Architecture documentation for the test_parsed_dict_schema() function in test_responses_api.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  d68d3c04_84f3_392b_f5c5_28787cc5a51c["test_parsed_dict_schema()"]
  992496d5_b7d4_139f_00cf_3e585d851f81["test_responses_api.py"]
  d68d3c04_84f3_392b_f5c5_28787cc5a51c -->|defined in| 992496d5_b7d4_139f_00cf_3e585d851f81
  style d68d3c04_84f3_392b_f5c5_28787cc5a51c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/openai/tests/integration_tests/chat_models/test_responses_api.py lines 248–265

def test_parsed_dict_schema(schema: Any) -> None:
    llm = ChatOpenAI(model=MODEL_NAME, use_responses_api=True)
    response = llm.invoke("how are ya", response_format=schema)
    parsed = json.loads(response.text)
    assert parsed == response.additional_kwargs["parsed"]
    assert parsed["response"]
    assert isinstance(parsed["response"], str)

    # Test stream
    full: BaseMessageChunk | None = None
    for chunk in llm.stream("how are ya", response_format=schema):
        assert isinstance(chunk, AIMessageChunk)
        full = chunk if full is None else full + chunk
    assert isinstance(full, AIMessageChunk)
    parsed = json.loads(full.text)
    assert parsed == full.additional_kwargs["parsed"]
    assert parsed["response"]
    assert isinstance(parsed["response"], str)

Domain

Subdomains

Frequently Asked Questions

What does test_parsed_dict_schema() do?
test_parsed_dict_schema() is a function in the langchain codebase, defined in libs/partners/openai/tests/integration_tests/chat_models/test_responses_api.py.
Where is test_parsed_dict_schema() defined?
test_parsed_dict_schema() is defined in libs/partners/openai/tests/integration_tests/chat_models/test_responses_api.py at line 248.

Analyze Your Own Codebase

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

Try Supermodel Free