Updated 2 days ago
AI SDK 7.0.155 drops runtime checks already covered by TypeScript

AI SDK 7.0.155 drops runtime checks already covered by TypeScript

The October 27 patch removes ModelMessage schema validation and other type‑redundant checks. Malformed untyped calls can reach TypeError, while value and prompt guards remain.

The patch removes checks that duplicate TypeScript types

Vercel’s [AI SDK 7.0.155 release](https://github.com/vercel/ai/releases/tag/ai%407.0.155), published on October 27, removes runtime checks for inputs already covered by the SDK’s TypeScript types. The change applies to the `ai` package at that version; it is not a statement about every provider package or older SDK release. The release says `streamText`, `generateText`, `generateObject` and `streamObject` no longer validate messages against the `ModelMessage` schema. It also removes type checks on call settings, steering messages, tool‑caller configuration and several other typed inputs. For developers, the important distinction is which checks disappeared. The patch removes checks that repeat the declared types, while retaining value constraints that the types do not establish.

Malformed untyped inputs can now produce a different error

The [implementation commit](https://github.com/vercel/ai/commit/b6b9dcaec7b0f68825fa7103a507f46cd8795e34) explains that the removed checks primarily guarded callers bypassing TypeScript through plain JavaScript, `any` or type assertions. The maintainers say malformed inputs from those callers can now produce a runtime `TypeError` instead of an SDK validation error. They describe callers that respect the types as seeing no change. That matters for an application wrapper that assumes malformed requests always reach its SDK‑specific error handler. A cast applied to incoming data and an input actually checked against the expected structure are different conditions. An upgrade review should therefore consider the wrapper’s input boundary and the error classes it handles, rather than assume the previous validation error will still identify every malformed call.

Value and prompt guards remain

The [release notes](https://github.com/vercel/ai/releases/tag/ai%407.0.155) still list runtime validation for value constraints such as integer ranges, non‑empty collections and unknown keys, as well as non‑finite numbers or cycles in `decide` JSON input. Those are retained examples from the notes, not a promise that every input field receives the same checks. The [commit](https://github.com/vercel/ai/commit/b6b9dcaec7b0f68825fa7103a507f46cd8795e34) separately states that empty messages and system messages are still checked. It also updates the `InvalidPromptError` documentation to reflect its current causes. Removing the `ModelMessage` schema pass therefore does not mean every prompt condition is accepted or that SDK validation errors disappear altogether. The concrete compatibility question is whether a caller relied on the checks being removed. Typed application code, unchecked external input and error‑handling code need to be considered separately when reviewing this patch. Guillermo Rauch, photographed on June 14, 2024. Archive Vercel company context, not the AI SDK interface or October 27 release. Photo: Oynickj, [via Wikimedia Commons](https://commons.wikimedia.org/wiki/File:Guillermo_Rauch_photo.jpg). This top‑cropped and resized photograph remains licensed under [CC BY‑SA 4.0](https://creativecommons.org/licenses/by‑sa/4.0/).

Share this article

PostShare

Related News