https://www.boundaryml.com logo
Is there any way to get at the tool call
# questions
u
Is there any way to get at the tool call information from a baml call? For example if I have:
Copy code
client<llm> ClaudeComputerUseClient {
  provider anthropic
  options {
    model "claude-sonnet-4-20250514"
    headers {
      "anthropic-beta" "computer-use-2025-01-24"
    }
    tools [
        {
          type computer_20250124
          name computer
          display_width_px 1024
          display_height_px 768
          display_number 1
        }
    ]
  }
}
function ClaudeComputerUser(task: string, screen: image) -> string {
    client ClaudeComputerUseClient
    prompt #"
        You are a computer user interacting with a desktop environment.
        Use the computer tool to return the next action you should take.
        Screenshot of your computer screen: {{ screen }}
        Your task: {{ task }}
    "#
}
I get some text back out, and I see the
StopReason: tool_use
, but don't see how I can actually get at any potential tool calls. I'd also like to do this for the OpenAI Computer Use model (which requires their own computer tool and the responses api), but baml blows up not expecting a
computer_call
message type (I guess because it's missing here: https://github.com/BoundaryML/baml/blob/canary/engine/baml-runtime/src/internal/llm_client/primitive/openai/response_handler.rs#L274-L302)
a
oh interesting i can patch that
whats the error you get though?
u
So a collector and then access the raw response object?
I don't have the exact error handy, I'll try to get a small reproduction, but it's something about serialize/deserialize computer_call
@aaronv (BAML) here's a reproducer for the unknown computer call thing:
Copy code
client<llm> OpenAIComputerUseClient {
  provider openai-responses
  options {
    model "computer-use-preview"
    reasoning {
        summary "concise"
    }
    truncation "auto"
    parallel_tool_calls false
    tools [
        {
            type "computer_use_preview"
            display_width 1440
            display_height 900
            environment "browser"
        }
    ]
  }
}

function OpenAIComputerUser(task: string, screen: image) -> string {
    client OpenAIComputerUseClient
    prompt #"
        You are a computer user interacting with a desktop environment.
        Use the computer tool to return the next action you should take.
        
        Screenshot of your computer screen: {{ screen }}
        Your task: {{ task }}
    "#
}

test OpenAIComputerUserClick {
  functions [OpenAIComputerUser]
  args {
    task #"
      Click the login button
    "#
    screen {file "screenshot.png" }
  }
}
Running the above results in the following error:
Copy code
Unspecified error code: 2 Failed to parse into a responses API stream event: {"type":"response.completed","sequence_number":4,"response":{"id":"resp_SANITIZED","object":"response","created_at":1753980513,"status":"completed","background":false,"error":null,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"computer-use-preview-2025-03-11","output":[{"id":"cu_688b9e62b25c8198bb69933d3e85190d0d36d38d997c4dbc","type":"computer_call","status":"completed","action":{"type":"screenshot"},"call_id":"call_DlyKaBLQGXcDjAjGOTcdFGIf","pending_safety_checks":[]}],"parallel_tool_calls":false,"previous_response_id":null,"prompt_cache_key":null,"reasoning":{"effort":"medium","generate_summary":"concise","summary":"concise"},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"}},"tool_choice":"auto","tools":[{"type":"computer_use_preview","display_height":900,"display_width":1440,"environment":"browser"}],"top_logprobs":0,"top_p":1.0,"truncation":"auto","usage":{"input_tokens":534,"input_tokens_details":{"cached_tokens":0},"output_tokens":7,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":541},"user":null,"metadata":{}}}

Caused by:
    unknown variant `computer_call`, expected one of `message`, `web_search_call`, `file_search_call`, `function_call`, `reasoning`

Request options: {"model":"computer-use-preview","reasoning":{"summary":"concise"},"truncation":"auto","parallel_tool_calls":false,"tools":[{"type":"computer_use_preview","display_width":1440,"display_height":900,"environment":"browser"}]}