Overview
This guide shows you how to integrate Latitude Telemetry into an existing application that uses Google Vertex AI via@google-cloud/vertexai.
After completing these steps:
- Every Vertex AI generation can be captured as a log in Latitude.
- Logs are attached to a specific prompt and version in Latitude.
- You can annotate, evaluate, and debug your Vertex AI-powered features from the Latitude dashboard.
You’ll keep calling Vertex AI directly — Telemetry simply observes and enriches those calls.
Requirements
Before you start, make sure you have:- A Latitude account and API key.
- At least one prompt created in Latitude.
- A Google Cloud project with Vertex AI enabled.
- A Node.js-based project that uses
@google-cloud/vertexai.
Steps
1
Install requirements
Add the Latitude Telemetry package to your project:
2
Initialize Latitude Telemetry with Vertex AI
Create a
LatitudeTelemetry instance and pass the Vertex AI module as an instrumentation.3
Wrap your Vertex AI-powered feature
Wrap the code that calls Vertex AI with a Telemetry prompt span, and execute your Vertex AI call inside that span.
Seeing your logs in Latitude
Once you’ve wrapped your Vertex AI-powered feature, you can see your logs in Latitude.- Go to the Traces section of your prompt in Latitude.
- You should see new entries every time your code is executed, including:
- Input/output messages
- Model name
- Latency and error information