Vercel AI SDK
The Vercel AI SDK is an elegant tool for building AI-powered applications. Braintrust natively supports tracing requests made with the Vercel AI SDK.
Vercel AI SDK v4 (native wrapper)
To use the native tracing wrapper, you can wrap a Vercel AI SDK model with wrapAISDKModel
and then use it as you would any other model.
Wrapping tools
Wrap tool implementations with wrapTraced
. Here is a full example, modified from the Node.js Quickstart.
When you run this code, you'll see traces like this in the Braintrust UI:
Vercel AI SDK v5
Just like the v4 version, this native integration automatically traces your model calls with the ai-sdk. We now provide a middleware that is a more flexible approach that allows you to include additional middleware.