Vercel has released updates to its AI SDK, specifically version @ai-sdk/workflow-harness@1.0.111, @ai-sdk/workflow@2.0.32, @ai-sdk/sandbox-vercel@1.0.111, and @ai-sdk/sandbox-just-bash@1.0.111. These releases address issues related to tool output serialization and schema handling for Gemini models.
Key Points
- The AI SDK now serializes tool output JSON values correctly, as indicated by patch change
6aa7c54inai@7.0.101. - For @ai-sdk/google@4.0.70, JSON Schema is preserved instead of being converted to OpenAPI schema (patch change
2a32459). - A fix ensures that
functionResponse.responseremains an object for Gemini models, which expect agoogle.protobuf.Struct(patch changed93e295). - Previously, non-object tool results could cause Gemini to close the socket with error
1007. - Non-object results are now wrapped under an
outputkey, aligning with Gemini's expectedgoogle.protobuf.Structformat.
Context
According to Vercel, these updates were released via the Changesets release GitHub action. The ai@7.0.101 package received a patch to fix tool output JSON serialization. The @ai-sdk/google@4.0.70 package specifically addressed how JSON schemas are handled and how functionResponse.response objects are managed for Gemini models.
Why It Matters
These updates improve the reliability of tool use and function calling within the Vercel AI SDK, particularly for developers integrating with Gemini models. Correct serialization and schema handling prevent unexpected disconnections and ensure data integrity when exchanging information between the SDK and Gemini.
What To Do
- Developers using the Vercel AI SDK should update to
ai@7.0.101or newer to benefit from the tool output serialization fix. - Users of @ai-sdk/google should update to version @ai-sdk/google@4.0.70 to ensure proper Gemini integration.
- Review the updated documentation for
onToolCallandaddToolOutputif encountering issues with non-object tool results in Gemini interactions.
