Home / Function/ test_handle_openai_responses_blocks() — langchain Function Reference

test_handle_openai_responses_blocks() — langchain Function Reference

Architecture documentation for the test_handle_openai_responses_blocks() function in test_utils.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  d20356fa_e9cf_3733_30c0_d18ccfb9cece["test_handle_openai_responses_blocks()"]
  ea3f8d89_f44b_6738_3cb9_a740a73cfca4["test_utils.py"]
  d20356fa_e9cf_3733_30c0_d18ccfb9cece -->|defined in| ea3f8d89_f44b_6738_3cb9_a740a73cfca4
  style d20356fa_e9cf_3733_30c0_d18ccfb9cece fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/messages/test_utils.py lines 1290–1320

def test_handle_openai_responses_blocks() -> None:
    blocks: str | list[str | dict] = [
        {"type": "reasoning", "id": "1"},
        {
            "type": "function_call",
            "name": "multiply",
            "arguments": '{"x":5,"y":4}',
            "call_id": "call_abc123",
            "id": "fc_abc123",
            "status": "completed",
        },
    ]
    message = AIMessage(content=blocks)

    expected_tool_call = {
        "type": "function",
        "function": {
            "name": "multiply",
            "arguments": '{"x":5,"y":4}',
        },
        "id": "call_abc123",
    }
    result = convert_to_openai_messages(message)
    assert isinstance(result, dict)
    assert result["content"] == blocks
    assert result["tool_calls"] == [expected_tool_call]

    result = convert_to_openai_messages(message, pass_through_unknown_blocks=False)
    assert isinstance(result, dict)
    assert result["content"] == [{"type": "reasoning", "id": "1"}]
    assert result["tool_calls"] == [expected_tool_call]

Subdomains

Frequently Asked Questions

What does test_handle_openai_responses_blocks() do?
test_handle_openai_responses_blocks() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/messages/test_utils.py.
Where is test_handle_openai_responses_blocks() defined?
test_handle_openai_responses_blocks() is defined in libs/core/tests/unit_tests/messages/test_utils.py at line 1290.

Analyze Your Own Codebase

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

Try Supermodel Free