Home / Function/ test_structured_output_json_schema_async() — langchain Function Reference

test_structured_output_json_schema_async() — langchain Function Reference

Architecture documentation for the test_structured_output_json_schema_async() function in test_chat_models.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  f0f54683_6c2a_6b32_70b0_9e318071bdaa["test_structured_output_json_schema_async()"]
  9003580b_9bcf_c959_a278_ba1963301452["test_chat_models.py"]
  f0f54683_6c2a_6b32_70b0_9e318071bdaa -->|defined in| 9003580b_9bcf_c959_a278_ba1963301452
  9e461ed6_e4e5_e9f4_e22d_4d9ed4b401b3["_check_parsed_result()"]
  f0f54683_6c2a_6b32_70b0_9e318071bdaa -->|calls| 9e461ed6_e4e5_e9f4_e22d_4d9ed4b401b3
  style f0f54683_6c2a_6b32_70b0_9e318071bdaa fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/mistralai/tests/integration_tests/test_chat_models.py lines 93–110

async def test_structured_output_json_schema_async(schema: Any) -> None:
    llm = ChatMistralAI(model="ministral-8b-latest")  # type: ignore[call-arg]
    structured_llm = llm.with_structured_output(schema, method="json_schema")

    messages = [
        {"role": "system", "content": "Extract the book's information."},
        {
            "role": "user",
            "content": "I recently read 'To Kill a Mockingbird' by Harper Lee.",
        },
    ]
    # Test invoke
    result = await structured_llm.ainvoke(messages)
    _check_parsed_result(result, schema)

    # Test stream
    async for chunk in structured_llm.astream(messages):
        _check_parsed_result(chunk, schema)

Domain

Subdomains

Frequently Asked Questions

What does test_structured_output_json_schema_async() do?
test_structured_output_json_schema_async() is a function in the langchain codebase, defined in libs/partners/mistralai/tests/integration_tests/test_chat_models.py.
Where is test_structured_output_json_schema_async() defined?
test_structured_output_json_schema_async() is defined in libs/partners/mistralai/tests/integration_tests/test_chat_models.py at line 93.
What does test_structured_output_json_schema_async() call?
test_structured_output_json_schema_async() calls 1 function(s): _check_parsed_result.

Analyze Your Own Codebase

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

Try Supermodel Free