Vercel AI SDK
This guide explains how to integrate HoneyHive with the Vercel AI SDK for TypeScript implementations.
Initializing HoneyHive Tracer
Use the following code to initialize HoneyHive tracing in your project:
For TypeScript/JavaScript projects, use the HoneyHiveTracer
class to initialize tracing:
This initializes tracing for your Vercel AI SDK application. Make sure to set the appropriate environment variables (HH_API_KEY
and HH_PROJECT
) before running your application.
Supported Vercel AI SDK Versions/Interfaces
Compatible with Vercel AI SDK versions supporting the experimental telemetry feature. Please check the Vercel AI SDK documentation for specific version compatibility.
For the most up-to-date compatibility information, please refer to the HoneyHive documentation.
Integrating with generateText
The Vercel AI SDK’s generateText
function supports telemetry integration through the experimental_telemetry
option. Here’s how to enable tracing:
Nesting
Nesting is handled automatically by the HoneyHive tracing system. When you use traced components within other traced components, the system will create a hierarchical structure of spans, reflecting the nested nature of your Vercel AI SDK operations.
Enriching Properties
For information on how to enrich your traces and spans with additional context, see our enrichment documentation.
Adding Evaluators
Once traces have been logged in the HoneyHive platform, you can then run evaluations with either Python or TypeScript.
Cookbook Examples
TypeScript Example
This example demonstrates how to integrate HoneyHive tracing with the Vercel AI SDK in a TypeScript environment, covering tracer initialization and text generation with OpenAI models.