Home / Function/ _make_computer_call_output_from_message() — langchain Function Reference

_make_computer_call_output_from_message() — langchain Function Reference

Architecture documentation for the _make_computer_call_output_from_message() function in base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  83f2962a_a930_da72_3b90_e0aa308605d3["_make_computer_call_output_from_message()"]
  2b046911_ea21_8e2e_ba0d_9d03da8d7bda["base.py"]
  83f2962a_a930_da72_3b90_e0aa308605d3 -->|defined in| 2b046911_ea21_8e2e_ba0d_9d03da8d7bda
  b988bc7d_ceff_06f1_193c_a22abc7a149f["_construct_responses_api_input()"]
  b988bc7d_ceff_06f1_193c_a22abc7a149f -->|calls| 83f2962a_a930_da72_3b90_e0aa308605d3
  style 83f2962a_a930_da72_3b90_e0aa308605d3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/openai/langchain_openai/chat_models/base.py lines 4028–4067

def _make_computer_call_output_from_message(
    message: ToolMessage,
) -> dict[str, Any] | None:
    computer_call_output: dict[str, Any] | None = None
    if isinstance(message.content, list):
        for block in message.content:
            if (
                message.additional_kwargs.get("type") == "computer_call_output"
                and isinstance(block, dict)
                and block.get("type") == "input_image"
            ):
                # Use first input_image block
                computer_call_output = {
                    "call_id": message.tool_call_id,
                    "type": "computer_call_output",
                    "output": block,
                }
                break
            if (
                isinstance(block, dict)
                and block.get("type") == "non_standard"
                and block.get("value", {}).get("type") == "computer_call_output"
            ):
                computer_call_output = block["value"]
                break
    elif message.additional_kwargs.get("type") == "computer_call_output":
        # string, assume image_url
        computer_call_output = {
            "call_id": message.tool_call_id,
            "type": "computer_call_output",
            "output": {"type": "input_image", "image_url": message.content},
        }
    if (
        computer_call_output is not None
        and "acknowledged_safety_checks" in message.additional_kwargs
    ):
        computer_call_output["acknowledged_safety_checks"] = message.additional_kwargs[
            "acknowledged_safety_checks"
        ]
    return computer_call_output

Domain

Subdomains

Frequently Asked Questions

What does _make_computer_call_output_from_message() do?
_make_computer_call_output_from_message() is a function in the langchain codebase, defined in libs/partners/openai/langchain_openai/chat_models/base.py.
Where is _make_computer_call_output_from_message() defined?
_make_computer_call_output_from_message() is defined in libs/partners/openai/langchain_openai/chat_models/base.py at line 4028.
What calls _make_computer_call_output_from_message()?
_make_computer_call_output_from_message() is called by 1 function(s): _construct_responses_api_input.

Analyze Your Own Codebase

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

Try Supermodel Free