Skip to content

Conversation

@ChuKhaLi
Copy link
Contributor

@ChuKhaLi ChuKhaLi commented May 25, 2025

Related GitHub Issue

Closes: #3967

Description

Add Google Gemini as provider for codebase indexing

Test Procedure

Type of Change

  • 🐛 Bug Fix: Non-breaking change that fixes an issue.
  • New Feature: Non-breaking change that adds functionality.
  • 💥 Breaking Change: Fix or feature that would cause existing functionality to not work as expected.
  • ♻️ Refactor: Code change that neither fixes a bug nor adds a feature.
  • 💅 Style: Changes that do not affect the meaning of the code (white-space, formatting, etc.).
  • 📚 Documentation: Updates to documentation files.
  • ⚙️ Build/CI: Changes to the build process or CI configuration.
  • 🧹 Chore: Other changes that don't modify src or test files.

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Code Quality:
    • My code adheres to the project's style guidelines.
    • There are no new linting errors or warnings (npm run lint).
    • All debug code (e.g., console.log) has been removed.
  • Testing:
    • New and/or updated tests have been added to cover my changes.
    • All tests pass locally (npm test).
    • The application builds successfully with my changes.
  • Branch Hygiene: My branch is up-to-date (rebased) with the main branch.
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Changeset: A changeset has been created using npm run changeset if this PR includes user-facing changes or dependency updates.
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Screenshots / Videos

After add Gemini as provider
image

Documentation Updates

Does this PR necessitate updates to user-facing documentation?

  • Yes, documentation updates are required. Add docs about codebase indexing, add Gemini as provider

Additional Notes

Get in Touch


Important

Adds Google Gemini as a provider for codebase indexing, updating configurations, UI, and tests to support it, along with new rate limiting and retry utilities.

  • Behavior:
    • Adds Google Gemini as a provider for codebase indexing in codebase-index.ts and provider-settings.ts.
    • Updates CodeIndexConfigManager in config-manager.ts to handle Gemini-specific configurations.
    • Implements CodeIndexGeminiEmbedder in embedders/gemini.ts for embedding tasks.
  • UI:
    • Updates CodeIndexSettings.tsx to include Gemini-specific settings and controls.
    • Adds Gemini-related translations in multiple language files.
  • Testing:
    • Updates tests in config-manager.spec.ts and service-factory.spec.ts to cover Gemini configurations.
  • Utilities:
    • Introduces SlidingWindowRateLimiter in rate-limiter.ts for rate limiting.
    • Adds RetryHandler in retry-handler.ts for handling retries with backoff.

This description was created by Ellipsis for 2149430. You can customize this summary. It will automatically update as commits are pushed.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label May 27, 2025
@ChuKhaLi ChuKhaLi force-pushed the feat/codebase-indexing-add-gemini-as-provider branch 2 times, most recently from 121fb4d to dfd9c66 Compare May 28, 2025 16:31
@hannesrudolph hannesrudolph moved this from Triage to PR [Draft / In Progress] in Roo Code Roadmap May 28, 2025
@ChuKhaLi ChuKhaLi changed the title WIP Feat codebase indexing add gemini as provider Feat codebase indexing add gemini as provider May 28, 2025
@ChuKhaLi ChuKhaLi marked this pull request as ready for review May 28, 2025 20:09
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. documentation Improvements or additions to documentation enhancement New feature or request labels May 28, 2025
@hannesrudolph hannesrudolph added PR - Draft / In Progress and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels May 28, 2025
ChuKhaLi added 4 commits June 23, 2025 01:46
…bedder

- Introduced SlidingWindowRateLimiter to manage request rates effectively, ensuring consistent request handling and memory efficiency.
- Added RetryHandler with exponential backoff and jitter to handle transient failures during API calls.
- Refactored CodeIndexGeminiEmbedder to utilize the new rate limiter and retry handler, improving error handling and request management.
- Enhanced batch processing logic for embedding texts, ensuring better performance and reliability.
@ChuKhaLi
Copy link
Contributor Author

Hi, @daniel-lxs

  • I did change the implementation of rate-limit, and retry strategy, please have a look
  • for model gemini-embedding-exp-03-07 (latest one), seems like they always return 429 error. I've checked my quota, it looks nomal, but the api always fails for me. The closest I could find is this Getting 429 Errors - But Usage Charts Show no Traffic
  • So I think I could remove the model gemini-embedding-exp-03-07 and get this pr merged for now.

@ChuKhaLi ChuKhaLi marked this pull request as ready for review June 22, 2025 19:53
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Jun 22, 2025
@ChuKhaLi ChuKhaLi requested a review from daniel-lxs June 22, 2025 19:57
@daniel-lxs
Copy link
Member

Thank you @ChuKhaLi!

I see that there's a failing unit test, do you mind taking a look?

@daniel-lxs daniel-lxs moved this from PR [Draft / In Progress] to PR [Changes Requested] in Roo Code Roadmap Jun 22, 2025
@ChuKhaLi
Copy link
Contributor Author

all passed now @daniel-lxs

@daniel-lxs daniel-lxs moved this from PR [Changes Requested] to PR [Needs Review] in Roo Code Roadmap Jun 22, 2025
@daniel-lxs daniel-lxs moved this from PR [Needs Review] to PR [Needs Prelim Review] in Roo Code Roadmap Jun 22, 2025
@daniel-lxs
Copy link
Member

I've been thinking about this PR for a while now.

The 429 errors from gemini-embedding-exp-03-07 are a real concern. It seems to be the only Gemini model suitable for indexing, since the others only support one batch at a time, which would slow things down significantly.

We might need to step back and figure out a more reliable way to support indexing without running into performance or rate limit issues.

I'm marking this PR as a draft for now, feel free to leave your thoughts!

@daniel-lxs daniel-lxs moved this from PR [Needs Prelim Review] to PR [Draft / In Progress] in Roo Code Roadmap Jun 27, 2025
@daniel-lxs daniel-lxs marked this pull request as draft June 27, 2025 20:11
@shariqriazz
Copy link
Contributor

switch to text-embedding-004 its quite high limit and fast, the quality is obviously not as good but a good starting point for gemini provider. Later when they take this new model out of experiment we can then include it?

@SannidhyaSah
Copy link
Collaborator

#5228 Has been created to implement this better. The exp model is unusable with 5 request/ minute . There's no need to add so much complixity in a task this simple . Further that pr allows us to go past the limitation ( batching ) of Google Gen AI client. making the process almost 10X Faster

@github-project-automation github-project-automation bot moved this from PR [Draft / In Progress] to Done in Roo Code Roadmap Jul 2, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jul 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request PR - Draft / In Progress size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Codebase Indexing: Add Google Gemini as provider

6 participants