Overview
The Vercel AI SDK provides a consistent API for interacting with various AI providers. Gentrace integrates seamlessly to provide automatic tracing and error analysis for your AI application.Prerequisites
This guide assumes you have already setup an interaction as shown in our quickstart.Instrumentation
The AI SDK natively exports to OpenTelemetry, and Gentrace can consume this telemetry automatically. To enable telemetry, set theexperimental_telemetry
flag to true
in your AI SDK calls.
For example:
The AI SDK call must be inside the callstack of an
interaction for Gentrace to capture the
trace.
Full example
.env
For an example in our SDK, see the OpenAI AI SDK
example
on GitHub.