Home / Function/ test_make_computer_call_output_from_message() — langchain Function Reference

test_make_computer_call_output_from_message() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/partners/openai/tests/unit_tests/chat_models/test_base.py lines 2901–2971

def test_make_computer_call_output_from_message() -> None:
    # List content
    tool_message = ToolMessage(
        content=[
            {"type": "input_image", "image_url": "data:image/png;base64,<image_data>"}
        ],
        tool_call_id="call_abc123",
        additional_kwargs={"type": "computer_call_output"},
    )
    result = _make_computer_call_output_from_message(tool_message)

    assert result == {
        "type": "computer_call_output",
        "call_id": "call_abc123",
        "output": {
            "type": "input_image",
            "image_url": "data:image/png;base64,<image_data>",
        },
    }

    # String content
    tool_message = ToolMessage(
        content="data:image/png;base64,<image_data>",
        tool_call_id="call_abc123",
        additional_kwargs={"type": "computer_call_output"},
    )
    result = _make_computer_call_output_from_message(tool_message)

    assert result == {
        "type": "computer_call_output",
        "call_id": "call_abc123",
        "output": {
            "type": "input_image",
            "image_url": "data:image/png;base64,<image_data>",
        },
    }

    # Safety checks
    tool_message = ToolMessage(
        content=[
            {"type": "input_image", "image_url": "data:image/png;base64,<image_data>"}
        ],
        tool_call_id="call_abc123",
        additional_kwargs={
            "type": "computer_call_output",
            "acknowledged_safety_checks": [
                {
                    "id": "cu_sc_abc234",
                    "code": "malicious_instructions",
                    "message": "Malicious instructions detected.",
                }
            ],
        },
    )
    result = _make_computer_call_output_from_message(tool_message)

    assert result == {
        "type": "computer_call_output",
        "call_id": "call_abc123",
        "output": {
            "type": "input_image",
            "image_url": "data:image/png;base64,<image_data>",
        },
        "acknowledged_safety_checks": [
            {
                "id": "cu_sc_abc234",
                "code": "malicious_instructions",
                "message": "Malicious instructions detected.",
            }
        ],
    }

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free