-
Notifications
You must be signed in to change notification settings - Fork 3.7k
feat(anthropic): support custom tool-reference content for deferred tool loading #12089
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?
Conversation
lgrammel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a potential breaking specification change that needs to wait until ai sdk 7
| | { | ||
| /** | ||
| * Custom content part. This can be used to implement | ||
| * provider-specific content parts. | ||
| */ | ||
| type: 'custom'; | ||
|
|
||
| /** | ||
| * Provider-specific options. | ||
| */ | ||
| providerOptions?: SharedV3ProviderOptions; | ||
| } | ||
| >; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lgrammel what if we added the type in custom object instead to avoid breaking changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's a good use of it, since it's a single provider that needs tool-reference content so far
|
Looks good. PR title and description are out of date. Presumably there is no way to do this without using a special tool result part? |
unfortunately no - they need a tool_reference object in the content part of the tool result to map the result. also updated the PR description and title; ready for review again |
Background
anthropic's deferred tool loading allows custom tool search implementations that return tool_reference blocks, but we didn't support this format. reference here
Summary
added support for custom tool-reference content for deferred tool loading
Manual Verification
verified via a reproduction script given by the user in
examples/ai-functions/src/generate-text/11829-repro.ts(will be deleted after review)Checklist
pnpm changesetin the project root)Related Issues
fixes #11829