Home / Function/ test_parsed_pydantic_schema_async() — langchain Function Reference

test_parsed_pydantic_schema_async() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/partners/openai/tests/integration_tests/chat_models/test_responses_api.py lines 228–243

async def test_parsed_pydantic_schema_async() -> None:
    llm = ChatOpenAI(model=MODEL_NAME, use_responses_api=True)
    response = await llm.ainvoke("how are ya", response_format=Foo)
    parsed = Foo(**json.loads(response.text))
    assert parsed == response.additional_kwargs["parsed"]
    assert parsed.response

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

Domain

Subdomains

Frequently Asked Questions

What does test_parsed_pydantic_schema_async() do?
test_parsed_pydantic_schema_async() 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_pydantic_schema_async() defined?
test_parsed_pydantic_schema_async() is defined in libs/partners/openai/tests/integration_tests/chat_models/test_responses_api.py at line 228.

Analyze Your Own Codebase

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

Try Supermodel Free