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

Computer Tool with external tools breaks ui chat chat messages #3937

Open
sullyo opened this issue Nov 29, 2024 · 0 comments
Open

Computer Tool with external tools breaks ui chat chat messages #3937

sullyo opened this issue Nov 29, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@sullyo
Copy link

sullyo commented Nov 29, 2024

Description

If you have computer use with another tool, the chat messages throw an error, due to invalid tool invocations

  const result = await streamText({
    model: anthropic("claude-3-5-sonnet-20241022"),
    maxSteps: 100,
    system:
      "You are a helpful assistant working on a computer. With the ability to navigate the web, type, click, and move the mouse.",
    messages: convertToCoreMessages(messages),
    tools: {
      computer: computerTool,
      navigation: {
        description: "Navigate to a specific url",
        parameters: z.object({
          url: z.string().describe("The url to navigate to"),
        }),
        execute: async ({ url }) => {
          const result = await computerControl({
            sessionId,
            action: "navigate",
            text: url,
          });
          return "Navigated to " + url;
        },
      },
    },
  });

You can invoke the tool once, but if you send 1 more chat message the error occurs:

 ⨯ MessageConversionError [AI_MessageConversionError]: ToolInvocation must have a result 
 {"state":"call","toolCallId":"toolu_01MwvrJfwyFqk8nEV6BPqzEA","toolName":"navigation","args":
 {"url":"https://www.espn.com"}}

Code example

No response

AI provider

"@ai-sdk/anthropic": "^1.0.2"

Additional context

No response

@sullyo sullyo added the bug Something isn't working label Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant