Home / Function/ test__construct_responses_api_input_skips_blocks_without_text() — langchain Function Reference

test__construct_responses_api_input_skips_blocks_without_text() — langchain Function Reference

Architecture documentation for the test__construct_responses_api_input_skips_blocks_without_text() function in test_base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  91b232ac_c040_5f1f_32d3_480f00d1e52a["test__construct_responses_api_input_skips_blocks_without_text()"]
  48232d20_f8c1_b597_14fa_7dc407e9bfe5["test_base.py"]
  91b232ac_c040_5f1f_32d3_480f00d1e52a -->|defined in| 48232d20_f8c1_b597_14fa_7dc407e9bfe5
  style 91b232ac_c040_5f1f_32d3_480f00d1e52a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/openai/tests/unit_tests/chat_models/test_base.py lines 2135–2164

def test__construct_responses_api_input_skips_blocks_without_text() -> None:
    """Test that blocks without 'text' key are skipped."""
    # Test case: block with type "text" but missing "text" key
    messages = [
        AIMessage(
            content=[
                {"type": "text", "text": "valid text", "id": "msg_123"},
                {"type": "text", "id": "msg_123"},  # Missing "text" key
                {"type": "output_text", "text": "valid output", "id": "msg_123"},
                {"type": "output_text", "id": "msg_123"},  # Missing "text" key
            ]
        )
    ]
    result = _construct_responses_api_input(messages)

    # Should only include blocks with valid text content
    assert len(result) == 1
    assert result[0]["type"] == "message"
    assert result[0]["role"] == "assistant"
    assert len(result[0]["content"]) == 2
    assert result[0]["content"][0] == {
        "type": "output_text",
        "text": "valid text",
        "annotations": [],
    }
    assert result[0]["content"][1] == {
        "type": "output_text",
        "text": "valid output",
        "annotations": [],
    }

Domain

Subdomains

Frequently Asked Questions

What does test__construct_responses_api_input_skips_blocks_without_text() do?
test__construct_responses_api_input_skips_blocks_without_text() is a function in the langchain codebase, defined in libs/partners/openai/tests/unit_tests/chat_models/test_base.py.
Where is test__construct_responses_api_input_skips_blocks_without_text() defined?
test__construct_responses_api_input_skips_blocks_without_text() is defined in libs/partners/openai/tests/unit_tests/chat_models/test_base.py at line 2135.

Analyze Your Own Codebase

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

Try Supermodel Free