Skip to main content

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 or Arize AX.

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

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

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file openinference_instrumentation_google_genai-1.4.0.tar.gz.

File metadata

File hashes

Hashes for openinference_instrumentation_google_genai-1.4.0.tar.gz
Algorithm Hash digest
SHA256 265935f09845c73a770c8a82c46e5a88277aaa054ad9cdd816ce845e6aa5378c
MD5 a56755eab5d4754c10a9aae47f6cad2d
BLAKE2b-256 f6946b2eac4b49a5be0431c8b0bfa7d6be71407708399b19916ce90c7d32391c

See more details on using hashes here.

Provenance

The following attestation bundles were made for openinference_instrumentation_google_genai-1.4.0.tar.gz:

Publisher: publish.yaml on Arize-ai/openinference

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file openinference_instrumentation_google_genai-1.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for openinference_instrumentation_google_genai-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 838d3bb42896eb978b3d9853430ada72a05307ee7d7eec936e10bab79134ddb5
MD5 b42351bd8edbfe4807b67ee90c4d0ea7
BLAKE2b-256 e89764f3fbd28d5a030db5d4d0714ee87b50df8693c818b506ef1fc4727bd410

See more details on using hashes here.

Provenance

The following attestation bundles were made for openinference_instrumentation_google_genai-1.4.0-py3-none-any.whl:

Publisher: publish.yaml on Arize-ai/openinference

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

1.4.2

2 files

1.4.1

2 files

This release

1.4.0 This release

2 files

1.3.0

2 files

1.2.0

2 files

1.1.1

2 files

1.1.0

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

0.1.17

2 files

0.1.16

2 files

0.1.15

2 files

0.1.14

2 files

0.1.13

2 files

0.1.12

2 files

0.1.10

2 files

0.1.9

2 files

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page