feat(closes OPEN-8244): Adds Gemini API client tracing #553
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request
Summary
This PR introduces a native
trace_geminiintegration to the Openlayer Python SDK, enabling automatic tracing of Google Gemini API calls.Changes
src/openlayer/lib/integrations/gemini_tracer.pyfor comprehensive Gemini API tracing (streaming, non-streaming, async, token counting, function calling, latency, time-to-first-token).src/openlayer/lib/integrations/__init__.pyto exporttrace_gemini.src/openlayer/lib/__init__.pyto exposetrace_geminiand include client validation.examples/tracing/google-gemini/gemini_tracing.ipynbwith concise usage examples for non-streaming, streaming, multi-turn, and configured generations.Context
This integration resolves
OPEN-8244by providing native support for tracing Google Gemini API calls, aligning with existing integrations liketrace_openai. This unblocks enterprise customers who prefer directgoogle.generativeaiclient usage over LangChain for their tracing, logging, and evaluation workflows.Testing
Linear Issue: OPEN-8244