Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable computer tool support in claude-3-7-sonnet. #1413

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

epatey
Copy link
Collaborator

@epatey epatey commented Feb 26, 2025

This PR contains:

  • New features
  • Changes to dev-tools e.g. CI config / github tooling
  • Docs
  • Bug fixes
  • Code refactor

What is the current behavior? (You can also link to an open issue here)

What is the new behavior?

  • Anthropic added new methods to the new tool schema
    • hold_key
    • left_mouse_down
    • left_mouse_up
    • triple_click
    • scroll
    • wait

Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)

Other information:

@@ -226,6 +226,7 @@ def model_call() -> ModelCall:
extra_headers = headers | {HttpxTimeTracker.REQUEST_ID_HEADER: request_id}
if computer_use:
betas.append("computer-use-2024-10-22")
betas.append("computer-use-2025-01-24")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can probably make this conditional based on self.is_thinking_model() (or do be more paranoid add an is_claude_3_7() method to match the is_claude_3_5() one we have).

# check for compatible 'computer' tool
if tool.name == "computer" and (
sorted(tool.parameters.properties.keys())
== sorted(["action", "coordinate", "text"])
):
return ComputerUseToolParam(
type="computer_20241022",
type="computer_20250124"
if model.startswith("claude-3-7-sonnet")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we could pass self and use our accessors to sort out versions

Copy link
Collaborator Author

@epatey epatey Feb 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol. it's a class. 🤦

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, notice though all the functions are NOT members! (that would have been too gross)

@AlexLloyd0
Copy link
Contributor

With this change the old tool signature + description is still used in the transcript.

image image

I guess it comes from the docstring in src/inspect_ai/tool/_tools/_computer/_computer.py.

I can't think of an elegant solution (maybe @jjallaire-aisi can 😁). It's not critical as it doesn't impact behaviour as far as I can tell.

@jjallaire
Copy link
Collaborator

@AlexLloyd0 That should either:

(a) Not appear at all for Claude 3.7 (since we use their tool definition); or
(b) For other models should be the updated description.

We'll sort this out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants