Home / Function/ test_structured_output_json_schema() — langchain Function Reference

test_structured_output_json_schema() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  62b43087_25ff_6b52_6afb_c79c5d38e699["test_structured_output_json_schema()"]
  ec975712_a998_0a1f_0930_22940fc39a1e["test_chat_models.py"]
  62b43087_25ff_6b52_6afb_c79c5d38e699 -->|defined in| ec975712_a998_0a1f_0930_22940fc39a1e
  84987bc6_51d3_8515_89bb_a48a2a072b5b["_get_joke_class()"]
  62b43087_25ff_6b52_6afb_c79c5d38e699 -->|calls| 84987bc6_51d3_8515_89bb_a48a2a072b5b
  style 62b43087_25ff_6b52_6afb_c79c5d38e699 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/fireworks/tests/integration_tests/test_chat_models.py lines 159–173

def test_structured_output_json_schema(schema_type: str) -> None:
    llm = ChatFireworks(model="accounts/fireworks/models/kimi-k2-instruct-0905")
    schema, validation_function = _get_joke_class(schema_type)  # type: ignore[arg-type]
    chat = llm.with_structured_output(schema, method="json_schema")

    # Test invoke
    result = chat.invoke("Tell me a joke about cats.")
    validation_function(result)

    # Test stream
    chunks = []
    for chunk in chat.stream("Tell me a joke about cats."):
        validation_function(chunk)
        chunks.append(chunk)
    assert chunk

Domain

Subdomains

Frequently Asked Questions

What does test_structured_output_json_schema() do?
test_structured_output_json_schema() is a function in the langchain codebase, defined in libs/partners/fireworks/tests/integration_tests/test_chat_models.py.
Where is test_structured_output_json_schema() defined?
test_structured_output_json_schema() is defined in libs/partners/fireworks/tests/integration_tests/test_chat_models.py at line 159.
What does test_structured_output_json_schema() call?
test_structured_output_json_schema() calls 1 function(s): _get_joke_class.

Analyze Your Own Codebase

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

Try Supermodel Free