Takaro - v0.6.0
    Preparing search index...

    Function instrumentGoogleGenAIClient

    • Instrument a Google GenAI client with Sentry tracing Can be used across Node.js, Cloudflare Workers, and Vercel Edge

      Type Parameters

      • T extends object

        The type of the client that extends client object

      Parameters

      • client: T

        The Google GenAI client to instrument

      • Optionaloptions: GoogleGenAIOptions

        Optional configuration for recording inputs and outputs

      Returns T

      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' });