Vercel's @ai-sdk/xai package, part of the AI SDK, has been updated to version 4.0.52. This release, dated September 1, introduces several new features for file interaction and management within the xAI files interface.
The update includes functions for retrieving file metadata, streaming file downloads, and deleting files. It also adds support for time-to-live (TTL) settings on uploads and enables streaming data uploads.
Key Points
- The @ai-sdk/xai package is updated to version 4.0.52.
- New functionalities include
getFileMetadata,downloadFile(streaming), anddeleteFileon the xAI files interface. - The update supports
expiresAfterupload TTLs, which are integers ranging from 3600 to 2,592,000 seconds. - Streaming uploads are now supported via
{ type: 'stream' }data. - Upload results expose
byteSize,createdAt, andexpiresAtproperties. - All file operations now thread
abortSignalandheaders. - The system rejects or encodes blank and dot-segment file IDs to prevent request path retargeting.
Context
According to Vercel, this release enhances the file handling capabilities within the @ai-sdk/xai component of their AI SDK. The changes improve how files are uploaded, managed, and accessed, particularly by adding streaming support and metadata exposure. The update also includes dependency updates for @ai-sdk/provider@4.0.10 and @ai-sdk/provider-utils@5.0.35.
Why It Matters
This update provides developers with more granular control over file operations and lifecycle management when interacting with xAI services through the Vercel AI SDK. The addition of streaming uploads and explicit TTL settings can optimize data transfer and storage practices.
What To Do
- Review the @ai-sdk/xai package documentation for details on
getFileMetadata,downloadFile, anddeleteFile. - Experiment with the
expiresAfterparameter for file uploads to manage data retention. - Test streaming uploads using the
{ type: 'stream' }data option for large files. - Note the new
byteSize,createdAt, andexpiresAtproperties available on upload results.