Skip to content

Conversation

@viniciusdsmello
Copy link
Contributor

Pull Request

Summary

This PR introduces a native trace_gemini integration to the Openlayer Python SDK, enabling automatic tracing of Google Gemini API calls.

Changes

  • Added src/openlayer/lib/integrations/gemini_tracer.py for comprehensive Gemini API tracing (streaming, non-streaming, async, token counting, function calling, latency, time-to-first-token).
  • Updated src/openlayer/lib/integrations/__init__.py to export trace_gemini.
  • Updated src/openlayer/lib/__init__.py to expose trace_gemini and include client validation.
  • Created examples/tracing/google-gemini/gemini_tracing.ipynb with concise usage examples for non-streaming, streaming, multi-turn, and configured generations.

Context

This integration resolves OPEN-8244 by providing native support for tracing Google Gemini API calls, aligning with existing integrations like trace_openai. This unblocks enterprise customers who prefer direct google.generativeai client usage over LangChain for their tracing, logging, and evaluation workflows.

Testing

  • Unit tests
  • Manual testing (verified functionality with the provided Jupyter notebook)
  • Postman CI/CD
  • Other (Jupyter notebook examples serve as functional tests)

Linear Issue: OPEN-8244

Open in Cursor Open in Web

Integrates tracing for Google Gemini LLM API calls. Includes a new example notebook.

Co-authored-by: vinicius <vinicius@openlayer.com>
@cursor
Copy link

cursor bot commented Nov 25, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

Co-authored-by: vinicius <vinicius@openlayer.com>
@viniciusdsmello viniciusdsmello changed the title Integrate gemini api tracing to python sdk feat(closes OPEN-8244): Adds Gemini API client tracing Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants