Vercel

AI SDK 4.1

Jan 20, 2025
AI SDK 4.1
SummaryAI, from the source post

AI SDK 4.1 introduces experimental image generation via the `generateImage` function, supporting multiple providers (Replicate, OpenAI, Google Vertex AI, Fireworks) and parameters like size, aspectRatio, n, seed, and provider-specific options. It also adds stream transformation and smoothing capabilities with `smoothStream` for better text streaming, filtering, and custom transformations. Persistence for `useChat` is simplified with improvements to chat ID forwarding, response message IDs, and the `appendResponseMessages` utility. Non-blocking data streaming is enabled with `createDataStreamResponse`, allowing for streaming retrieval-augmented generation (RAG) context and search results before LLM responses. Tool calling is enhanced with improved context in the `execute` function, including `toolCallId`, `messages` array, and `abortSignal`. Structured output improvements include a new `zod` schema for defining tool parameters and a `JSONSchema` type for generating JSON schemas. New and updated providers are also included.

More from the AI Gateway and AI SDK Integration trail