Vercel has issued updates across several AI SDK packages, including @ai-sdk/workflow@2.0.32, @ai-sdk/sandbox-vercel@1.0.111, @ai-sdk/tui@1.0.102, and @ai-sdk/svelte@5.0.101. These releases address issues related to tool output serialization and schema handling for Google Gemini models.
Key Points
- The
ai@7.0.101package includes a fix to serialize tool output JSON values. - The
@ai-sdk/google@4.0.70package now preserves JSON Schema instead of converting it to OpenAPI schema. - A fix in
@ai-sdk/google@4.0.70ensuresfunctionResponse.responseremains an object for Gemini models. - Gemini expects
google.protobuf.StructforfunctionResponse.response, which only accepts objects. - Previously, non-object tool results (string, number, array, null) could cause Gemini to close the socket with code 1007.
- Non-object tool results are now wrapped under an
outputkey as prescribed by the field's documentation.
Context
According to the Vercel AI SDK changelog, these updates aim to improve the reliability of tool calls and responses, particularly when interacting with Google Gemini models. The changes ensure that data types align with the expectations of the Gemini API, preventing connection issues that previously occurred with non-object tool outputs.
Why It Matters
These updates are significant for developers using the Vercel AI SDK with Google Gemini, as they resolve critical issues that could lead to unexpected disconnections and incorrect schema interpretations. The fixes enhance the stability and predictability of tool use within AI applications.
What To Do
- Update your Vercel AI SDK packages to the latest versions, specifically
ai@7.0.101and@ai-sdk/google@4.0.70. - Review your tool implementations to ensure compatibility with the updated serialization of JSON values.
- Test tool calls with Google Gemini models to confirm that non-object results are now correctly handled.
