ai ai@6.0.330
- Source
- github.com
- Author
- github-actions[bot]Top Viber
- Date

Context
Version 6.0.330 of `ai`, the core package of Vercel's AI SDK for building AI features in TypeScript, fixes a slowdown that grew with the length of a streamed list. The SDK can ask a model for , and two of its functions stream an array of typed items, for example one weather record per city: `streamText` with `Output.array`, and the older `streamObject`. Each item is checked against a schema, a description of the fields it must have, and handed to the application as soon as it is complete. According to the release notes, the package previously parsed and validated the entire array received so far every time another chunk of text arrived from the model. Each chunk therefore cost more than the one before it, and a long array kept the processor busy re-reading items it had already checked.
The fix processes each completed item once. In the published package, the new code (`src/util/array-output-stream.ts`) reads only the newly arrived text, tracks where each item ends, and holds back the last item until the next one starts or the whole response closes, which its comments say matches how the old parser treated incomplete output. If the model's response does not have the expected shape, it falls back to the old parser. The notes give no measured CPU figure. The fix is on the version 6 line, where `streamObject` is already deprecated in favor of `streamText` with an `output` setting, and both paths get it. Applications on version 6 that stream long arrays, especially servers handling many such streams at once, are the ones that benefit from upgrading.
- structured output — Forcing a model's response to match a schema, so downstream code can parse it instead of guessing at prose.
- streaming — Sending a model's response token by token as it is generated, so the reader sees text immediately instead of waiting for the whole answer.
Checking sign-in…
Loading comments…






