Skip to content

Migrate AI SDK integration from v5 to v6#382

Merged
mattpocock merged 3 commits intov1from
matt/ai-sdk-v6
Feb 20, 2026
Merged

Migrate AI SDK integration from v5 to v6#382
mattpocock merged 3 commits intov1from
matt/ai-sdk-v6

Conversation

@mattpocock
Copy link
Owner

Summary

  • Bump AI SDK deps to v6 (ai ^6, @ai-sdk/provider ^3) and migrate core types (LanguageModelV1LanguageModel, MockLanguageModelV1MockLanguageModelV3, etc.)
  • Migrate scorers from generateObject() to generateText() + Output.object() pattern for structured output
  • Update documentation and test fixtures to reflect v6 APIs
  • Add changeset for the breaking change

Test plan

  • Verify pnpm build succeeds
  • Verify pnpm --filter evalite-tests test passes with updated MockLanguageModelV3 fixtures
  • Verify AI SDK caching tests pass with new patterns
  • Confirm docs correctly reference v6 APIs

🤖 Generated with Claude Code

@changeset-bot
Copy link

changeset-bot bot commented Feb 20, 2026

🦋 Changeset detected

Latest commit: 9ee7e17

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Feb 20, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
evalite Ignored Ignored Feb 20, 2026 1:05pm
evalite-beta-docs Ignored Ignored Feb 20, 2026 1:05pm

mattpocock and others added 3 commits February 20, 2026 13:05
Task: Foundational vertical slice for AI SDK v5→v6 migration.

Key decisions:
- Public types use version-agnostic aliases (LanguageModel, EmbeddingModel from "ai")
- Internal middleware types use version-specific V3 types from @ai-sdk/provider
- Usage shape adapted: inputTokens/outputTokens now objects with .total, totalTokens computed as sum
- Middleware specificationVersion: 'v3' added per v6 requirement
- Removed obsolete "media" content type check (replaced by "file" in v6)

Files changed:
- packages/evalite/package.json: ai ^5→^6, @ai-sdk/provider ^2→^3
- packages/evalite/src/ai-sdk.ts: V2→V3 types, LanguageModel public API, usage shape migration
- packages/evalite/src/types.ts: LanguageModelV2→LanguageModel, EmbeddingModelV2<string>→EmbeddingModel
- packages/evalite-tests/package.json: ai ^5→^6, @ai-sdk/openai ^2→^3
- packages/example/package.json: ai ^5→^6, @ai-sdk/openai ^2→^3, @ai-sdk/provider ^2→^3
- apps/evalite-ui/package.json: ai ^5→^6
- pnpm-lock.yaml: updated

Blockers: #380 needs MockLanguageModelV2→V3 migration in test fixtures + scorer generateObject→generateText migration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…tures to MockLanguageModelV3 (#380)

Task: Migrate all v5 API usage to v6 patterns per PRD #378.

Key decisions:
- Scorers: generateObject() → generateText() + Output.object(), result.object → result.output
- Mocks: MockLanguageModelV2 → MockLanguageModelV3 with plain object doGenerate (not function)
- Usage shape: V3 nested objects { inputTokens: { total }, outputTokens: { total } }
- FinishReason: V3 object shape { unified: "stop", raw: undefined }
- Removed obsolete rawCall, providerMetadata, request, response from mock fixtures

Files changed:
- packages/evalite/src/scorers/utils/statement-evaluation.ts (3 call sites)
- packages/evalite/src/scorers/answer-correctness.ts (1 call site)
- packages/evalite/src/scorers/answer-relevancy.ts (1 call site)
- packages/evalite/src/scorers/context-recall.ts (1 call site)
- packages/evalite-tests/tests/fixtures/ai-sdk-traces/traces.eval.ts
- packages/evalite-tests/tests/fixtures/ai-sdk-caching/caching.eval.ts
- packages/evalite-tests/tests/fixtures/ai-sdk-caching-config-disabled/caching.eval.ts
- packages/evalite-tests/tests/fixtures/ai-sdk-caching-config-precedence/caching.eval.ts
- packages/example/src/fake-models.eval.ts

Blockers: #381 (docs + changeset) is now unblocked.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Task: Update docs to reflect v6 migration per PRD #378.

Key decisions:
- Type signature: LanguageModelV2 → LanguageModel (version-agnostic alias)
- Structured output: generateObject/streamObject → generateText/streamText + Output.object()
- tips/vercel-ai-sdk.mdx already v6-compatible, no changes needed
- Minor version changeset for evalite package

Files changed:
- apps/evalite-docs/src/content/docs/api/ai-sdk.mdx
- .changeset/0000-ai-sdk-v6.md

Blockers: None. All #378 PRD tasks are now complete.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mattpocock mattpocock merged commit cef8166 into v1 Feb 20, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant