The type of the client that extends client object
The Google GenAI client to instrument
Optionaloptions: GoogleGenAIOptionsOptional configuration for recording inputs and outputs
The instrumented client with the same type as the input
import { GoogleGenAI } from '@google/genai';
import { instrumentGoogleGenAIClient } from '@sentry/core';
const genAI = new GoogleGenAI({ apiKey: process.env.GOOGLE_GENAI_API_KEY });
const instrumentedClient = instrumentGoogleGenAIClient(genAI);
// Now both chats.create and sendMessage will be instrumented
const chat = instrumentedClient.chats.create({ model: 'gemini-1.5-pro' });
const response = await chat.sendMessage({ message: 'Hello' });
Instrument a Google GenAI client with Sentry tracing Can be used across Node.js, Cloudflare Workers, and Vercel Edge