Home / Function/ test__construct_lc_result_from_responses_api_multiple_messages() — langchain Function Reference

test__construct_lc_result_from_responses_api_multiple_messages() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/partners/openai/tests/unit_tests/chat_models/test_base.py lines 1488–1553

def test__construct_lc_result_from_responses_api_multiple_messages() -> None:
    """Test a response with multiple text blocks."""
    response = Response(
        id="resp_123",
        created_at=1234567890,
        model="gpt-4o",
        object="response",
        parallel_tool_calls=True,
        tools=[],
        tool_choice="auto",
        output=[
            ResponseOutputMessage(
                type="message",
                id="msg_123",
                content=[
                    ResponseOutputText(type="output_text", text="foo", annotations=[])
                ],
                role="assistant",
                status="completed",
            ),
            ResponseReasoningItem(
                type="reasoning",
                id="rs_123",
                summary=[Summary(type="summary_text", text="reasoning foo")],
            ),
            ResponseOutputMessage(
                type="message",
                id="msg_234",
                content=[
                    ResponseOutputText(type="output_text", text="bar", annotations=[])
                ],
                role="assistant",
                status="completed",
            ),
        ],
    )

    # v0
    result = _construct_lc_result_from_responses_api(response, output_version="v0")

    assert result.generations[0].message.content == [
        {"type": "text", "text": "foo", "annotations": []},
        {"type": "text", "text": "bar", "annotations": []},
    ]
    assert result.generations[0].message.additional_kwargs == {
        "reasoning": {
            "type": "reasoning",
            "summary": [{"type": "summary_text", "text": "reasoning foo"}],
            "id": "rs_123",
        }
    }
    assert result.generations[0].message.id == "msg_234"

    # responses/v1
    result = _construct_lc_result_from_responses_api(response)

    assert result.generations[0].message.content == [
        {"type": "text", "text": "foo", "annotations": [], "id": "msg_123"},
        {
            "type": "reasoning",
            "summary": [{"type": "summary_text", "text": "reasoning foo"}],
            "id": "rs_123",
        },
        {"type": "text", "text": "bar", "annotations": [], "id": "msg_234"},
    ]
    assert result.generations[0].message.id == "resp_123"

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free