-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Tool calls stopped working when switching from gpt-4o to anthropic claude-sonnet #2106
Comments
Strange! it should work, can you check this demo: https://github.com/vercel/ai/blob/main/examples/ai-core/src/generate-text/anthropic-chatbot-with-tools.ts However, there is a bug for anthropic around empty parameters: #2103 (potential duplicate) |
Don't think it's the same as in #2103 as I don't have any errors in console, I get response from the basic I will try to experiment with it a bit and get back to you if I find out anything new. Thanks for fast response and confirming that it should work! |
@d-ivashchuk oh - that means that the anthropic model did not call the tool as expected. This is typically a prompt engineering issue. Maybe changing "description" to some definition of when the model should call the tool might help? |
I added optional param and tool started to be executed. You might have been right with the first bug reference in your message. Funnily enough before with gpt-4o when tool had been executed there was no generation running. Now I have both an answer from the text stream and also a tool execution |
i have the same picture, but it's look like a bug for me. the expected behavior is that text generation will not be called at all |
yeah, before I switched from gpt-4o it was exactly the behaviour that you described @anikiyevichm(the correct one with no text generation called at all) Again it would be super handy to see what's going on behind the scenes in tool calling and get some debug logs to make it more prominent! |
Description
I couldn't find it in the docs if tool calling is properly supported for anthropic models, but I don't have any type errors or runtime errors so I assumed it should work.
I changed from gpt-4o to claude-sonnet and sudennly tool calls are being ignored all togehter.
@lgrammel thanks a lot for your wonderful work maintaining ai-sdk, I hope there is some easy workaround for this if tools are not supported in anthropic 🙇🏼♂️
Code example
Additional context
No response
The text was updated successfully, but these errors were encountered: