Home / Function/ test_response_format_with_output_config() — langchain Function Reference

test_response_format_with_output_config() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  5ea7fff9_583a_36ef_0868_544a3a3f6098["test_response_format_with_output_config()"]
  18428dc5_a41b_90c6_88ad_615296ee3311["test_chat_models.py"]
  5ea7fff9_583a_36ef_0868_544a3a3f6098 -->|defined in| 18428dc5_a41b_90c6_88ad_615296ee3311
  style 5ea7fff9_583a_36ef_0868_544a3a3f6098 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/anthropic/tests/unit_tests/test_chat_models.py lines 1679–1703

def test_response_format_with_output_config() -> None:
    """Test that response_format is converted to output_config.format."""

    class Person(BaseModel):
        """Person data."""

        name: str
        age: int

    # Test that response_format converts to output_config.format
    model = ChatAnthropic(model=MODEL_NAME)
    payload = model._get_request_payload(
        "Test query",
        response_format=Person.model_json_schema(),
    )
    assert "output_config" in payload
    assert "format" in payload["output_config"]
    assert payload["output_config"]["format"]["type"] == "json_schema"
    assert "schema" in payload["output_config"]["format"]

    # No response_format - output_config should not have format
    model = ChatAnthropic(model=MODEL_NAME)
    payload = model._get_request_payload("Test query")
    if "output_config" in payload:
        assert "format" not in payload["output_config"]

Domain

Subdomains

Frequently Asked Questions

What does test_response_format_with_output_config() do?
test_response_format_with_output_config() is a function in the langchain codebase, defined in libs/partners/anthropic/tests/unit_tests/test_chat_models.py.
Where is test_response_format_with_output_config() defined?
test_response_format_with_output_config() is defined in libs/partners/anthropic/tests/unit_tests/test_chat_models.py at line 1679.

Analyze Your Own Codebase

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

Try Supermodel Free