Vercel's AI SDK received updates on August 15, enhancing its integration with Moonshot AI and xAI. The @ai-sdk/moonshotai@3.0.35 release focuses on normalizing tool schemas for Moonshot AI's MFJS validator, while the @ai-sdk/xai@4.0.40 release introduces new text-to-speech capabilities and improved error handling for xAI.
Key Points
- The
@ai-sdk/moonshotai@3.0.35release normalizes tool schemas for Moonshot AI's MFJS validator. - Tuple
itemsarrays becomeprefixItemsin the normalized schema for Moonshot AI. - The
typenext toanyOfmoves into the branches for Moonshot AI schemas. - Non-object root schemas for Moonshot AI now result in a client-side error instead of an opaque 400 from Moonshot.
- The original schema is still used for AI SDK result validation with Moonshot AI.
- The
@ai-sdk/xai@4.0.40release addswithTimestampsandreplaceprovider options for xAI text-to-speech. withTimestampsexposes duration, content type, and character-level alignment viaproviderMetadata.xaifor xAI speech responses.providerMetadata.xai.traceId(from thex-trace-idheader) is now returned on every xAI speech response.- Text-to-speech error parsing for xAI has been improved, providing real error details in
APICallErrormessages.
Context
According to the Vercel AI SDK Changelog, these updates aim to improve the developer experience by addressing specific integration challenges with Moonshot AI and enhancing the functionality and error reporting for xAI's text-to-speech services. The schema normalization for Moonshot AI helps prevent opaque 400 errors by providing clearer client-side feedback.
Why It Matters
These updates provide developers using the Vercel AI SDK with more robust and predictable interactions when integrating with Moonshot AI for tool use and with xAI for text-to-speech functionalities. The improvements in error handling and metadata exposure can streamline debugging and enhance the quality of applications built on these platforms.
What To Do
- Review the updated documentation for
@ai-sdk/moonshotairegarding tool schema definitions. - Test existing Moonshot AI integrations to ensure compatibility with the new schema normalization.
- Explore the
withTimestampsandreplaceoptions for xAI text-to-speech in the AI SDK. - Implement error handling to leverage the improved
APICallErrormessages from xAI text-to-speech.
