OpenInference Google GenAI Instrumentation
Project description
OpenInference Google GenAI Instrumentation
Python auto-instrumentation library for GenAI SDK. Traces are fully OpenTelemetry compatible and can be sent to any OpenTelemetry collector for viewing, such as Arize Phoenix.
Installation
pip install -Uqqq openinference-instrumentation-google-genai
Quickstart
Install openinference-instrumentation-google-genai and arize-phoenix.
pip install -U \
openinference-instrumentation-google-genai \
arize-phoenix \
opentelemetry-sdk \
opentelemetry-exporter-otlp \
"opentelemetry-proto>=1.12.0"
Start the phoenix server so that it is ready to receive traces.
The phoenix server runs entirely on your machine and does not send data over the internet.
phoenix serve
Instrumenting genai is simple.
from openinference.instrumentation.google_genai import GoogleGenAIInstrumentor
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import SimpleSpanProcessor
endpoint = "http://127.0.0.1:4317"
tracer_provider = TracerProvider()
tracer_provider.add_span_processor(SimpleSpanProcessor(OTLPSpanExporter(endpoint)))
GoogleGenAIInstrumentor().instrument(tracer_provider=tracer_provider)
Now, all calls by generate_content are instrumented and can be viewed in the phoenix UI.
Progress
This instrumentation is a work in progress
- parse messages and invocation
- capture tool definitions
More Info
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 openinference_instrumentation_google_genai-0.1.6.tar.gz.
File metadata
- Download URL: openinference_instrumentation_google_genai-0.1.6.tar.gz
- Upload date:
- Size: 30.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bdcd97dc79302c731af494cec47febba9b1727ea65ce97b151a7a24623b0856d
|
|
| MD5 |
53c6c86c7ac29046e81aa9ef3226212e
|
|
| BLAKE2b-256 |
8e998803170078edfd3d8165f74915295701706bcd57263a513284d2c0d4d5bf
|
File details
Details for the file openinference_instrumentation_google_genai-0.1.6-py3-none-any.whl.
File metadata
- Download URL: openinference_instrumentation_google_genai-0.1.6-py3-none-any.whl
- Upload date:
- Size: 22.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e9e35b8cc1601049e19f1141385a90e3b4131e33a61cd3c61ced143fe6fb872
|
|
| MD5 |
146e21289c9415757b5d3ba1301b2914
|
|
| BLAKE2b-256 |
0e33d0b8184cce06dc5a8e3910347f0ea1b2b206f1133c3a715e17ba22d90581
|