-
Notifications
You must be signed in to change notification settings - Fork 35
Support AI SDK 5 #93
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?
Support AI SDK 5 #93
Conversation
commit: |
agent-playground@93 did not compile output dist? |
@defrex does it work now? |
Hm, not quite. The number of messages seems correct, but I'm getting the same "Tool result without preceding tool call.. adding anyway" warning in console and the tool-call is still split into two parts. {
"type": "tool-call",
"toolCallId": "toolu_01WDyAEZkVRCZF91wb8j15ah",
"state": "input-available",
"input": {
"dataSourceId": "js77sg17kf8wp6t9m459w9be157meqaj"
},
"toolName": "get_data_source_documentation",
},
{
"type": "tool-get_data_source_documentation",
"toolCallId": "toolu_01WDyAEZkVRCZF91wb8j15ah",
"state": "output-available",
"output": {
"type": "json",
"value": {
"data": {
"description": "[...etc]",
"documentation": "[...etc]",
"title": "Northwind",
"type": "postgres"
},
"success": true
}
}
} I believe in ai sdk v5 they should be combined into {
"type": "tool-get_data_source_documentation",
"toolCallId": "toolu_01WDyAEZkVRCZF91wb8j15ah",
"state": "output-available",
"input": {
"dataSourceId": "js77sg17kf8wp6t9m459w9be157meqaj"
},
"output": {
"type": "json",
"value": {
"data": {
"description": "[...etc]",
"documentation": "[...etc]",
"title": "Northwind",
"type": "postgres"
},
"success": true
}
}
}, That is, the tool-call should result in a single The type for |
I did some experimenting locally and put up a PR that gets this working: #104 |
Update a single `tool-[toolName]` part in `toUIMessages`
- Updated UIMessage type to accept METADATA, DATA_PARTS, and TOOLS generics - Made toUIMessages function generic with the same type parameters - Added proper type annotations for tool parts and message arrays - Fixed tool UI part type constraints
- Add @ai-sdk/provider-utils to peerDependencies in package.json - Update src/mapping.ts with related functionality changes - Generate pnpm-lock.yaml for new dependency
@ianmacartney I have a PR that replaces the Node API — could you review it? npm isn't responding on my machine, so I can't update the lockfile |
Replaces the Node Buffer API used in the toUIFilePart function with standard web APIs
Fixes #79
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.