-
Notifications
You must be signed in to change notification settings - Fork 434
fix: non-OpenAI models w/ OpenRouter send an empty string when calling tools #499
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
base: main
Are you sure you want to change the base?
fix: non-OpenAI models w/ OpenRouter send an empty string when calling tools #499
Conversation
… an empty object is the valid option
🦋 Changeset detectedLatest commit: 938a841 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Related to vercel/ai#6687 |
|
Thanks for sending this, but I am unsure if this should be done on this SDK side. |
|
This PR is stale because it has been open for 10 days with no activity. |
|
Thank you for all of the help! I wasn't able to get to it sooner due have a procedure. It is the 9th one this year so that I really appreciate all of the support on this! |
|
This PR is stale because it has been open for 10 days with no activity. |
|
@ertembiyik I haven't checked this for a while, but doesn't the latest ai-sdk still handle this pattern in a good way? If yes, we may consider having this workaround on our side. |
hey! let me check it today with ai-sdk/provider version 3 and come back |
|
upd: i have tested the issue against ai sdk v6.0.0-beta.72 and @ai-sdk/provider v3.0.0-beta.8 the issue is still reproducible, i have simplified the example to not include composio, im now using a tool from @openai/agents with an empty object important to mention that this issue seems to be reproducible on anthropic/claude-sonnet-4 model from openrouter, though on x-ai/grok-4-fast it seems to work just fine here is the example i used: |
|
did one more test, where i took pure ai sdk solution w/ openrouter without relying on agents sdk. it did fine for anthropic/claude-sonnet-4 in the exact same empty object case here it is: with that said, seems like the agents sdk is the source of the issue |
Summary
Some models on OpenRouter called tools with empty object params using "" instead of {}, when headed to traces, it's clear that agent is calling tools with empty args:
This results in error:
Example
Here is a minimal reproducible example:
agents-bug.zip
Changes
Tests