OpenInference VertexAI Instrumentation
Reason this release was yanked:
Rename of common instrumentation config classes
Project description
OpenInference Google VertexAI Instrumentation
Python auto-instrumentation library for VertexAI SDK and the Google Cloud AI Platform. 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-vertexai
Quickstart
Install openinference-instrumentation-vertexai
and arize-phoenix
.
pip install -U \
openinference-instrumentation-vertexai \
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.
python -m phoenix.server.main serve
Instrumenting vertexai
is simple.
from openinference.instrumentation.vertexai import VertexAIInstrumentor
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)))
VertexAIInstrumentor().instrument(tracer_provider=tracer_provider)
Now, all calls by generative_models
are instrumented and can be viewed in the phoenix
UI.
import vertexai
from vertexai.generative_models import GenerativeModel
vertexai.init(location="us-central1")
model = GenerativeModel("gemini-1.5-flash")
print(model.generate_content("Why is sky blue?"))
More Info
More details about tracing with OpenInference and phoenix
can be found in the phoenix
documentation.
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
File details
Details for the file openinference_instrumentation_vertexai-0.1.1.tar.gz
.
File metadata
- Download URL: openinference_instrumentation_vertexai-0.1.1.tar.gz
- Upload date:
- Size: 20.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 39e04917e49cf584cf185067c2757c608a9c786367a643a1528857dc8bde64a6 |
|
MD5 | 2bdf611435a7aef2563551812bf6751e |
|
BLAKE2b-256 | c3eae403943a05251b2cd4757ff0e2a442a5e84b58a73715f7cb06fbd4f9b4a0 |
File details
Details for the file openinference_instrumentation_vertexai-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: openinference_instrumentation_vertexai-0.1.1-py3-none-any.whl
- Upload date:
- Size: 16.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1327889a89ca0c9917be6121833dc63bcad9a68d52e81c1ac90faf3f2a20f3d6 |
|
MD5 | 2b1de94bc0cec1aa573b114c45b21b55 |
|
BLAKE2b-256 | 4079ee4d66b5f1fa61ffea6a8c4894eb6ca540feab057c6323ff150a0ff9e8d3 |