The Vercel AI SDK has released updates, including version @ai-sdk/vue@4.0.101, that modify how tool outputs are processed, particularly for Google's Gemini models. These changes aim to improve the reliability of tool use within the SDK when interacting with Gemini.
Key Points
- The @ai-sdk/google@4.0.70 package now preserves JSON Schema instead of converting it to OpenAPI schema.
- A fix ensures that Gemini's
functionResponse.responsefield, which expects agoogle.protobuf.Struct, remains an object. - Previously, non-object tool results (strings, numbers, arrays, or null) could be sent unwrapped, causing Gemini to close the socket with a 1007 error.
- The @ai-sdk/google@4.0.70 update now wraps non-object tool results under an
outputkey before transmission. - The core
ai@7.0.101package includes a fix for serializing tool output JSON values.
Context
According to the Vercel AI SDK changelog, these updates address specific technical issues encountered when using tools with Gemini models. The google.protobuf.Struct type for functionResponse.response in Gemini requires an object, and previous SDK behavior could lead to incorrect data types being sent, resulting in connection issues.
Why It Matters
These updates are important for developers using the Vercel AI SDK with Google's Gemini models, as they resolve critical issues related to tool output serialization and schema handling. This improves the stability and predictability of applications that rely on Gemini's tool-calling capabilities.
What To Do
- Developers using @ai-sdk/google should update to version @ai-sdk/google@4.0.70 or later.
- Review applications that use tool calling with Gemini to ensure they are compatible with the updated serialization behavior.
- Note the change in how non-object tool results are wrapped under an
outputkey. - Check the
ai@7.0.101package for the general fix on serializing tool output JSON values.
