OpenTelemetry instrumentation for Google Gen AI
Project description
Google Gen AI OpenTelemetry Integration
Overview
This integration provides support for using OpenTelemetry with the Google Gen AI framework. It enables tracing and monitoring of applications built with Google Gen AI.
Installation
- Install traceAI Google Gen AI
pip install traceAI-google-genai
Set Environment Variables
Set up your environment variables to authenticate with FutureAGI
import os
os.environ["FI_API_KEY"] = FI_API_KEY
os.environ["FI_SECRET_KEY"] = FI_SECRET_KEY
Quickstart
Register Tracer Provider
Set up the trace provider to establish the observability pipeline. The trace provider:
from fi_instrumentation import register
from fi_instrumentation.fi_types import ProjectType
trace_provider = register(
project_type=ProjectType.OBSERVE,
project_name="google_genai_project"
)
Configure Google Gen AI Instrumentation
Instrument the Google Gen AI client to enable telemetry collection. This step ensures that all interactions with the Google Gen AI SDK are tracked and monitored.
from traceai_google_genai import GoogleGenAIInstrumentor
GoogleGenAIInstrumentor().instrument(tracer_provider=trace_provider)
Make a request
Set up your Google Gen AI client with built-in observability.
from google import genai
from google.genai import types
client = genai.Client(vertexai=True, project="your_project_name", location="global")
content = types.Content(
role="user",
parts=[
types.Part.from_text(text="Hello how are you?"),
],
)
response = client.models.generate_content(
model="gemini-2.0-flash-001", contents=content
)
print(response)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file traceai_google_genai-0.1.0.tar.gz.
File metadata
- Download URL: traceai_google_genai-0.1.0.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.0 CPython/3.13.0 Darwin/24.1.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dad755684d38dd4cfc69926629eb8ee8c389446fe6e0e2a15caff433ba737717
|
|
| MD5 |
ecd936b72040a9246fce77424d21c390
|
|
| BLAKE2b-256 |
326e566fbe2971d6f63aee47c9b5272cfb8647e442b098ef9ed1b2088a2f2fd7
|
File details
Details for the file traceai_google_genai-0.1.0-py3-none-any.whl.
File metadata
- Download URL: traceai_google_genai-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.0 CPython/3.13.0 Darwin/24.1.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fdd0cf5661b1f45270cbc92f01148eaa082b794696065d9ed3526723667e1dd
|
|
| MD5 |
137533058b41c42ef2f652622c3cfbfd
|
|
| BLAKE2b-256 |
0d74c6ae4c5c6081b24375a128e351d69b621a0e5793574cd80ad2b14f06e802
|