Skip to content

Conversation

@Devesh36
Copy link

@Devesh36 Devesh36 commented Nov 3, 2025

AI SDK 5 Migration

This PR completes the migration from AI SDK v4 to v5, addressing all 50+ TypeScript errors.

Changes:

  • ✅ Updated dependencies to v5 versions
  • ✅ Refactored message structure (content → parts array)
  • ✅ Updated tool definitions (parameters → inputSchema)
  • ✅ Fixed streaming API (DataStreamWriter → UIMessageStreamWriter)
  • ✅ Updated component types (Message → UIMessage)
  • ✅ Converted attachment handling (experimental_attachments → parts)
  • ✅ Fixed tool state names (call → input-available)

Breaking Changes Addressed:

  • Message.content replaced with Message.parts array
  • Tool state machine redesigned with new state names
  • Streaming API completely rewritten
  • Attachment handling migrated to parts array

Testing:

  • All TypeScript compilation errors resolved
  • Components updated to work with new structure
  • API route refactored for v5 streaming

- Update ai package: 4.1.17 → 5.0.0
- Update @ai-sdk/openai: 1.1.12 → 2.0.0
- Update @ai-sdk/anthropic: 1.1.8 → 2.0.0
- Update zod: 3.23.8 → 4.1.8
- Refactor message structure: content → parts array
- Update tool state names: call → input-available
- Convert streaming API to v5 (createUIMessageStreamResponse removed)
- Update dataStream API: writeData → write, parameters → inputSchema
- Fix components to work with new UIMessage structure with parts array
- Add ai-legacy npm alias for compatibility layer
@vercel
Copy link

vercel bot commented Nov 3, 2025

@Devesh36 is attempting to deploy a commit to the tscircuit Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

@rushabhcodes rushabhcodes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirm that no breaking changes in request/response structure

Copy link

@rushabhcodes rushabhcodes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@seveibar
Copy link
Contributor

seveibar commented Nov 4, 2025

Hey guys i appreciate you digging into this, but we don't have the bandwidth to maintain chat.tscircuit.com right now

Copy link

@nailoo nailoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

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.

4 participants