Vercel has issued updates to its AI SDK, with @ai-sdk/sandbox-vercel@1.0.111, @ai-sdk/vue@4.0.101, @ai-sdk/svelte@5.0.101, and @ai-sdk/tui@1.0.102 among the packages receiving changes. These releases include fixes for how tool output JSON values are serialized and how Gemini tool responses are handled.
Key Points
- The @ai-sdk/google@4.0.70 package now preserves JSON Schema instead of converting it to OpenAPI schema.
- A fix addresses an issue where Gemini would close the socket with code 1007 if a non-object tool result was sent unwrapped.
- The
functionResponse.responsefield for Gemini is now maintained as an object, aligning with itsgoogle.protobuf.Structtyping. - Non-object tool results are now wrapped under an
outputkey before transmission to Gemini. - The core
aipackage, version 7.0.101, includes a fix for serializing tool output JSON values.
Context
According to Vercel, the updates specifically target interactions with Gemini, where the google.protobuf.Struct type for functionResponse.response expects an object. Previously, onToolCall returning unknown and addToolOutput accepting unknown could lead to non-object results (such as strings, numbers, arrays, or null) being sent unwrapped, causing Gemini to terminate the connection.
Why It Matters
These updates improve the reliability of tool use with Gemini models within the Vercel AI SDK, ensuring that tool outputs are correctly formatted and transmitted. This change can prevent unexpected disconnections and improve the stability of applications integrating Gemini through the SDK.
What To Do
- Developers using the Vercel AI SDK with Gemini should update to @ai-sdk/google@4.0.70 or later.
- Review applications that handle tool outputs to ensure compatibility with the new serialization behavior.
- Note that non-object tool results are now encapsulated within an
outputkey.
