Arize-ai / openinference

Auto-Instrumentation for AI Observability
https://arize-ai.github.io/openinference/
Apache License 2.0
147 stars 22 forks source link

[gemini/vertex] text instrumentation #565

Open mikeldking opened 2 days ago

mikeldking commented 2 days ago

Instrument the Vertex AI text completion endpoints:

import vertexai
from vertexai.generative_models import GenerativeModel

# TODO(developer): Update and un-comment below line
# project_id = "PROJECT_ID"

vertexai.init(project=project_id, location="us-central1")

model = GenerativeModel(model_name="gemini-1.5-flash-001")

response = model.generate_content(
    "What's a good name for a flower shop that specializes in selling bouquets of dried flowers?"
)

print(response.text)

https://cloud.google.com/vertex-ai/generative-ai/docs/start/quickstarts/quickstart-multimodal