Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add Gemini API integration #650

Merged
merged 44 commits into from
Jan 18, 2025
Merged

Conversation

devin-ai-integration[bot]
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Jan 17, 2025

Fixed method binding issues in GeminiProvider and improved error handling.

Changes:

  • Use module-level storage for original method
  • Fix provider initialization in tracker.py
  • Add graceful error handling for missing API key

Tested:

Additional Changes:

  • Add _extract_token_counts helper method for consistent token handling
  • Make error handling consistent with OpenAI provider
  • Remove redundant session checks
  • Improve error message formatting
  • Add comprehensive documentation
  • Set "gemini-1.5-flash" as default model value
  • Move API key configuration to provider level
  • Add comprehensive test coverage for error handling

Documentation Updates:

  • Enhanced README.md in examples/gemini_examples/ with:
    • Detailed setup instructions
    • Code examples for sync and streaming
    • Features and notes sections
    • Links to additional resources
  • Updated docs/v1/integrations/gemini.mdx with:
    • Automatic provider detection
    • Environment setup guide
    • Code samples and examples
    • Feature documentation
  • Updated example notebook with auto-initialization
    • Removed manual provider.override() calls
    • Added graceful API key handling
    • Improved error messages

Latest Test Results:

Link to Devin run: https://app.devin.ai/sessions/bf5d3093cfb84eac8a046d4c2f6f992e

devin-ai-integration bot and others added 3 commits January 17, 2025 02:25
- Add GeminiProvider class for tracking Gemini API calls
- Support both sync and streaming modes
- Track prompts, completions, and token usage
- Add test script demonstrating usage

Co-Authored-By: Alex Reibman <[email protected]>
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add "(aside)" to your comment to have me ignore it.
  • Look at CI failures and help fix them

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link

codecov bot commented Jan 17, 2025

Codecov Report

Attention: Patch coverage is 16.52174% with 96 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
agentops/llms/providers/gemini.py 16.82% 89 Missing ⚠️
agentops/llms/tracker.py 12.50% 7 Missing ⚠️

📢 Thoughts on this report? Let us know!

devin-ai-integration bot and others added 25 commits January 17, 2025 02:38
…dling and event recording

Co-Authored-By: Alex Reibman <[email protected]>
@areibman areibman requested a review from the-praxs January 17, 2025 10:14
@areibman
Copy link
Contributor

Devin did good I think, check it out @the-praxs

Copy link
Member

@the-praxs the-praxs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall the integration was done well. Such small integrations can be done with Devin but the maintenance will be the real challenge.

Comments are left to improve the code structure and efficiency. The notebooks should be modified to follow the same structure as the other notebooks.

Docs are absent. They need to be added for a complete integration.

Sometime later would like to have ActionEvent and ToolEvent events also if they are supported.

agentops/llms/tracker.py Outdated Show resolved Hide resolved
agentops/llms/providers/gemini.py Outdated Show resolved Hide resolved
agentops/llms/providers/gemini.py Outdated Show resolved Hide resolved
agentops/llms/providers/gemini.py Show resolved Hide resolved
agentops/llms/providers/gemini.py Outdated Show resolved Hide resolved
agentops/llms/providers/gemini.py Outdated Show resolved Hide resolved
@the-praxs the-praxs requested a review from areibman January 18, 2025 18:52
@the-praxs the-praxs self-requested a review January 18, 2025 18:54
@the-praxs the-praxs enabled auto-merge (squash) January 18, 2025 18:54
@the-praxs the-praxs disabled auto-merge January 18, 2025 18:54
@the-praxs the-praxs enabled auto-merge (squash) January 18, 2025 18:55
@the-praxs the-praxs merged commit 543b180 into main Jan 18, 2025
8 of 10 checks passed
@the-praxs the-praxs deleted the devin/1737080675-gemini-integration branch January 18, 2025 18:55
@the-praxs
Copy link
Member

I would like to state that this was mergeable because I fixed it.

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.

2 participants