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

bug(anthropic): tool use returns error #66

Closed
1 task done
faassen opened this issue Oct 18, 2024 · 2 comments · Fixed by #67
Closed
1 task done

bug(anthropic): tool use returns error #66

faassen opened this issue Oct 18, 2024 · 2 comments · Fixed by #67
Assignees

Comments

@faassen
Copy link

faassen commented Oct 18, 2024

  • I have looked for existing issues (including closed) about this

Bug Report

I'm trying to use with Anthropic. I can't get it to work, I get 400 as soon as I include any tools.

Reproduction

Any anthropic call with tools should replicate this behavior.

Expected behavior

Anthropic should use tools

Additional context

I did some debugging and there are a few things that seem to hinder tool use being initiated at all:

  • For some reason there's a 'cache_control' in ToolDefinition for Anthropic. That's not documented as far as I can see, and disabling seemed to improve the situation.

  • tool_choice: {"type": "auto"} seems to be required in the request JSON to get tool usage at all.

When I make both modifications to rig, things seem to go further; Anthropic thinks for a while, but finally I get the following error:

Failed to prompt Claude Sonnet: CompletionError(HttpError(reqwest::Error { kind: Decode, source: Error("data did not match any variant of untagged enum Content", line: 0, column: 0) }))

So it appears Anthropic returns something that isn't properly handled by rig?

Testing?

I like Rig's API so far, and I know it's alpha, but while the Anthropic functionality is in the API my impression (also from #65) is that not really ready yet. It strikes me that some kind of integration testing is in order in order to determine a client really works for the various works cases, and doesn't get broken.

Automated testing would be nice, but testing with an external service is always tricky to do automatically. Right now I'm testing it. :)

@faassen faassen added the bug label Oct 18, 2024
@0xMochan
Copy link
Contributor

0xMochan commented Oct 21, 2024

Appreciate the testing related to tool testing, I'll be taking a look at this closely to fix this up quickly!

Testing

100% agree. After talking with the team, we discussed moving up our plans for integration testing and perhaps some sort of mocking service to test the endpoints would be very much up the alley soon!

@cvauclair
Copy link
Contributor

@0xMochan looking at the issue rn, where does ToolDefinition::cache_control (in the Anthropic integration) come from? I don't see it in the API docs 🤔

@mateobelanger mateobelanger changed the title bug: tool use doesn't work with Anthropic bug(anthropic): tool use returns error Oct 22, 2024
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 a pull request may close this issue.

3 participants