Skip to content

Conversation

@continue
Copy link
Contributor

@continue continue bot commented Dec 10, 2025

Summary

This PR fixes the TypeScript compilation errors introduced by upgrading the ai package 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:

  1. Property renamed: maxTokensmaxOutputTokens in generateText/streamText calls
  2. Tool call property renamed: tc.argstc.input for accessing tool call inputs
  3. Usage properties renamed:
    • result.usage.promptTokensresult.usage.inputTokens
    • result.usage.completionTokensresult.usage.outputTokens

Files Changed

  • packages/openai-adapters/src/apis/Anthropic.ts
  • packages/openai-adapters/src/apis/OpenAI.ts

Testing

  • ✅ TypeScript compilation now passes
  • ✅ Build succeeds without errors

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.

  • Bug Fixes
    • Replace maxTokens with maxOutputTokens in generateText/streamText.
    • Use tc.input instead of tc.args for tool calls.
    • Map usage to inputTokens/outputTokens/totalTokens with safe defaults.

Written for commit c34e194. Summary will update automatically on new commits.

- Replace maxTokens with maxOutputTokens in generateText/streamText calls
- Replace tc.args with tc.input for tool call inputs
- Replace result.usage.promptTokens/completionTokens with inputTokens/outputTokens

These changes fix TypeScript compilation errors after upgrading the ai
package from v4.3.19 to v5.0.52 as part of the Snyk security update.

Generated with [Continue](https://continue.dev)

Co-Authored-By: Continue <[email protected]>
Co-authored-by: nate <[email protected]>
@continue continue bot requested a review from a team as a code owner December 10, 2025 23:14
@continue continue bot requested review from Patrick-Erichsen and removed request for a team December 10, 2025 23:14
@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Dec 10, 2025
@continue continue bot merged commit f55e8f4 into snyk-fix-29893fa185d8c83d0ae23b9800ed9849 Dec 10, 2025
8 checks passed
@continue continue bot deleted the fix/ai-sdk-v5-compatibility branch December 10, 2025 23:16
@github-project-automation github-project-automation bot moved this from Todo to Done in Issues and PRs Dec 10, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Dec 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

size:S This PR changes 10-29 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant