Vercel has released updates to its AI SDK, specifically addressing issues within the @ai-sdk/google package and general tool output serialization. These updates are part of releases such as @ai-sdk/sandbox-just-bash@1.0.111, @ai-sdk/angular@3.0.101, @ai-sdk/code-mode@1.0.58, @ai-sdk/google@4.0.70, @ai-sdk/sandbox-vercel@1.0.111, @ai-sdk/vue@4.0.101, and @ai-sdk/tui@1.0.102.
Key Points
- The ai@7.0.101 package includes a fix to serialize tool output JSON values.
- The @ai-sdk/google@4.0.70 package now preserves JSON Schema instead of converting it to OpenAPI schema.
- A fix in @ai-sdk/google@4.0.70 ensures that Gemini's
functionResponse.responsefield remains an object. - Previously, non-object tool results (string, number, array, or null) sent to Gemini could cause a socket closure with code 1007.
- Non-object tool results are now wrapped under an
outputkey as prescribed by the field's documentation.
Context
According to Vercel, these changes address specific technical challenges encountered when integrating with Gemini models and handling tool outputs. The functionResponse.response field in Gemini expects a google.protobuf.Struct, which is designed to accept only objects. The previous behavior allowed non-object results to be sent unwrapped, leading to connection issues.
Why It Matters
These updates improve the reliability of tool calling when using the Vercel AI SDK with Gemini models. Developers can expect more stable interactions and fewer unexpected disconnections when their tools return non-object JSON values.
What To Do
- Update to ai@7.0.101 or later to benefit from improved JSON serialization.
- Update to @ai-sdk/google@4.0.70 or later if using Gemini models with the SDK.
- Review tool implementations to ensure they align with the updated handling of non-object tool results.
- Test existing applications with the new SDK versions to confirm compatibility and stability.
Keep Exploring
/atlas/**gemini**-family /techniques/output-schema /techniques/ptcf