-
Notifications
You must be signed in to change notification settings - Fork 38
Closed
Description
🆙 Proposal: Update Vercel AI SDK from v4 to v5
Summary
This issue proposes upgrading the vercel/ai SDK dependency from v4 to the latest v5 release in the nuxtui-pro/chat project. The Vercel AI SDK v5 introduces significant improvements in API design, streaming support, fine-grained response handling, and better integrations with edge environments — making it a valuable update for our chat experience.
Motivation
- Improved DX (Developer Experience): v5 introduces a more ergonomic API with better typings and modularity.
- Streaming Enhancements: Cleaner handling of streaming responses using native web APIs (
ReadableStream) and new utilities likeexperimental_streamText. - Edge Compatibility: Improved out-of-the-box support for deployment on Vercel Edge Functions or other edge runtimes.
- Long-Term Support: v5 is the actively maintained and forward-compatible version. Remaining on v4 may cause future integration friction.
Impact Areas
server/api/chat.ts: The current usage ofOpenAIStream,StreamingTextResponse, etc. needs to be updated to the new APIs (streamText,experimental_streamText, etc.).- Middleware & runtime setup: Vercel AI v5 offers more flexibility in how handlers are structured (e.g., use of
POSTrequest handlers and betterrequesttyping). - Any components consuming streaming output from the server endpoint may require review (e.g.,
ChatStream.vue).
Migration Plan
- Replace v4-specific imports such as
OpenAIStreamandStreamingTextResponsewith v5’sstreamText()API. - Adjust server route handlers to accommodate the new streaming model.
- Validate compatibility with the current OpenAI or Anthropic provider configuration used in the app.
- Test the updated chat endpoint under Vercel edge runtime using local dev (
vercel dev) and production preview. - Update documentation and usage references in
README.mdor developer notes (if any). - Ensure all TypeScript typings and ESLint rules pass with the updated SDK.
References
Checklist
- Investigate compatibility with current OpenAI configuration
- Update server API endpoints
- Refactor streaming handling logic
- Test locally and on preview deployment
- Create PR with upgrade and relevant notes
Metadata
Metadata
Assignees
Labels
No labels