Immutable solution version
3.0.20 create a breaking change for StreamingTextResponse
Complete solution
A practical guide for Vercel AI SDK. StreamingTextResponse breaking change in ai 3.0.20: the upgrade changed output from plain text to protocol-framed chunks like 0:"...". If useChat/useCompletion misbehaves, check for a client/server SDK version mismatch and rebuild.
The problem
Issue vercel/ai#1316 (closed, 37 comments): ### Description the correct response with ai@3.0.19: [image] the error response with ai@3.0.20: [image] it cause an issue with it: https://github.com/lobehub/lobe-chat/issues/1945 ### Code example ``ts import { OpenAIStream, StreamingTextResponse } from 'ai'; import OpenAI, { ClientOptions } from 'openai'; const response = await this.client.chat.completions.create(postPayload); return new StreamingTextResponse(OpenAIStream(response)); ### Additional context I check the update code, I think it's a breaking change for StreamingTextResponse` : [image] please consider to revert it. Or I have
The fix
StreamingTextResponse breaking change in ai 3.0.20: the upgrade changed output from plain text to protocol-framed chunks like 0:"...". If useChat/useCompletion misbehaves, check for a client/server SDK version mismatch and rebuild. If your endpoint sends a plain text stream, set streamMode: "text" in useChat. With custom server code, pin the ai package version.
Notes
Thread: https://github.com/vercel/ai/issues/1316. Verified against the closed issue and the maintainer/accepted answer there.
Evidence
In https://github.com/vercel/ai/issues/1316, the reporter asked: Issue vercel/ai#1316 (closed, 37 comments): ### Description the correct response with ai@3.0.19: [image] the error response with ai@3.0.20: [image] it cause an issue with it: https://github.com/lobehub/lobe-chat/issues/1945 ### Code example ``ts import { OpenAIStream, StreamingTextResponse } from 'ai'; import OpenAI, { ClientOptions } from 'openai'; const response = await this.client.chat.completions.create(postPayload); return new StreamingTextResponse(OpenAIStream(response)); ### Additional context I check the update code, I think it's a breaking change for StreamingTextResponse : [image] please consider to revert it. Or I have The verified answer: StreamingTextResponse breaking change in ai 3.0.20: the upgrade changed output from plain text to protocol-framed chunks like 0:"...". If useChat/useCompletion misbehaves, check for a client/server SDK version mismatch and rebuild. If your endpoint sends a plain text stream, set streamMode: "text"` in useChat. With custom server code, pin the ai package version. Source thread: https://github.com/vercel/ai/issues/1316
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_Ea2_pmqAwATpQPiCZP30AA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">3.0.20 create a breaking change for StreamingTextResponse <span>— Vectle</span></a>