-
Notifications
You must be signed in to change notification settings - Fork 3
feat: support AI SDK v5 and v6 via unified imports [ENG-11722] #269
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
Conversation
Remove direct dependencies on @ai-sdk/provider and @ai-sdk/provider-utils internal packages. Import JSONSchema7 and Tool types directly from the main 'ai' package instead. This change: - Removes @ai-sdk/provider and @ai-sdk/provider-utils from devDependencies - Updates peerDependencies to accept ai >=5.0.0 <7.0.0 - Simplifies the dependency tree for consumers Both AI SDK v5 and v6 export the required types from the main package, making the internal package dependencies unnecessary.
commit: |
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.
Pull request overview
This PR updates the SDK to support both AI SDK v5 and v6 by importing types from the main ai package instead of internal packages (@ai-sdk/provider and @ai-sdk/provider-utils), simplifying the dependency tree and improving compatibility.
- Imports
JSONSchema7andTooltypes from the mainaipackage instead of internal packages - Updates peer dependency range to
>=5.0.0 <7.0.0to accept both v5 and v6 - Removes unnecessary internal package dependencies and updates the catalog accordingly
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/tool.ts |
Changes import of JSONSchema7 from @ai-sdk/provider to ai package; includes minor formatting improvements |
src/types.ts |
Changes import of Tool type from @ai-sdk/provider-utils to ai package |
tsdown.config.ts |
Removes @ai-sdk/provider-utils from TypeScript declaration file resolution configuration |
package.json |
Removes @ai-sdk/provider and @ai-sdk/provider-utils from devDependencies |
pnpm-workspace.yaml |
Updates AI SDK dependencies in catalog to v3.x versions and changes peer dependency range to >=5.0.0 <7.0.0 |
pnpm-lock.yaml |
Updates lockfile to reflect dependency changes, upgrading to AI SDK v6.0.6 and removing internal package references |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
No issues found across 6 files
- Import peerDependencies from package.json to dynamically show supported AI SDK version range in installation error messages - Update JSDoc comments to reference 'ai' package instead of @ai-sdk/provider-utils - Simplify try-import example to use generic install hint This ensures error messages stay in sync with peerDependencies when the supported version range changes.
Add ai package to catalog:dev (^6.0.7) for development and testing, separate from the peer dependency range (>=5.0.108 <7.0.0). Also add @ai-sdk/* and ai to minimumReleaseAgeExclude since AI SDK releases frequently and we want to stay up-to-date.
glebedel
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.
LGTM
Summary
@ai-sdk/providerand@ai-sdk/provider-utilsinternal packagesJSONSchema7andTooltypes directly from the mainaipackageai >=5.0.108 <7.0.0Why
Both AI SDK v5 and v6 export the required types from the main package, making the internal package dependencies unnecessary. This simplifies the dependency tree for consumers and allows the SDK to work with both v5 and v6 of the AI SDK.
Changes
src/tool.tsJSONSchema7fromaiinstead of@ai-sdk/provider, use dynamic peerDependencies for error messagessrc/types.tsToolfromaiinstead of@ai-sdk/provider-utilstsdown.config.ts@ai-sdk/provider-utilsfrom dts resolvepackage.jsonpnpm-workspace.yaml>=5.0.108 <7.0.0Test Plan