The Vercel AI SDK has released an update to its @ai-sdk/baseten package, version 2.1.0, which alters how the native performance client for embeddings is handled. This change makes the client an opt-in component, addressing previous issues with its integration.
Key Points
- The @ai-sdk/baseten@2.1.0 package makes the native performance client opt-in for embeddings.
- @basetenlabs/performance-client is no longer a direct dependency of the @ai-sdk/baseten package.
- The native client is a NAPI addon, comprising 16 platform binary packages and requiring 5-16 MB of installation space.
- This addon previously could not load in edge runtimes, and bundlers struggled to resolve its platform binaries.
- The native client was imported at the module top level, meaning all consumers incurred its overhead even if they only used embeddings.
- Embeddings now utilize plain HTTP to an OpenAI-compatible endpoint, which Baseten Embeddings Inference serves without additional configuration.
- Users can maintain client-side batching and request hedging by manually installing @basetenlabs/performance-client and passing its constructor.
Context
According to the Vercel AI SDK changelog, the previous implementation of the native performance client presented challenges. Its nature as a NAPI addon led to compatibility issues with edge runtimes and difficulties for bundlers. Furthermore, its top-level import meant that all users of the @ai-sdk/baseten package bore the cost of its dependency, regardless of whether they used its embedding features.
Why It Matters
This update from Vercel AI SDK simplifies the dependency structure for developers using @ai-sdk/baseten, potentially reducing bundle sizes and improving compatibility with various deployment environments, especially edge runtimes. It allows developers to choose whether to include the native performance client based on their specific needs for embedding features.
What To Do
- Developers using @ai-sdk/baseten should note the change in dependency for the native performance client.
- If client-side batching and request hedging are desired for embeddings, install @basetenlabs/performance-client separately.
- Review the updated @ai-sdk/baseten documentation for guidance on integrating the performance client.
- Test applications in edge runtimes to confirm improved compatibility following this update.
