fix: ai SDK v5 compatibility for Snyk security upgrade #9118
+12
−12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes the TypeScript compilation errors introduced by upgrading the
aipackage from v4.3.19 to v5.0.52 in PR #9113.Changes
The ai SDK v5 introduced breaking API changes that required updates to our code:
maxTokens→maxOutputTokensin generateText/streamText callstc.args→tc.inputfor accessing tool call inputsresult.usage.promptTokens→result.usage.inputTokensresult.usage.completionTokens→result.usage.outputTokensFiles Changed
packages/openai-adapters/src/apis/Anthropic.tspackages/openai-adapters/src/apis/OpenAI.tsTesting
Related
This agent session was co-authored by nate and Continue.
Summary by cubic
Updates the OpenAI and Anthropic adapters for ai SDK v5 to restore the build after the Snyk security upgrade. Fixes TypeScript errors by aligning request and usage fields with the new API.
Written for commit c34e194. Summary will update automatically on new commits.