-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: add Gemini embedding provider for codebase indexing #5228
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
Merged
mrubens
merged 6 commits into
RooCodeInc:main
from
SannidhyaSah:geminiembedding-provider
Jul 3, 2025
Merged
feat: add Gemini embedding provider for codebase indexing #5228
mrubens
merged 6 commits into
RooCodeInc:main
from
SannidhyaSah:geminiembedding-provider
Jul 3, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Changed VSCodeTextField to use placeholder instead of default value - Users can now clear the field without it auto-filling - Maintains backward compatibility with existing configurations - All existing tests continue to pass
This was referenced Jun 29, 2025
Contributor
|
You might wanna adjust MAX_TOKENS_PER_TEXT: 2048 for this model |
24 tasks
- Fix inconsistent logic in CodeIndexSettings where Gemini was incorrectly included in OpenAI model fallback - Add clarifying comment for hardcoded Gemini embedding dimension (768) in service-factory
…splay - Add GEMINI_MAX_ITEM_TOKENS constant (2048) for text-embedding-004 model - Update OpenAICompatibleEmbedder to accept configurable maxItemTokens - Pass token limit from GeminiEmbedder to OpenAICompatibleEmbedder - Fix UI to properly display Gemini model in dropdown - Update tests to handle new maxItemTokens parameter
daniel-lxs
approved these changes
Jul 1, 2025
Member
daniel-lxs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @SannidhyaSah
LGTM
mrubens
approved these changes
Jul 3, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
enhancement
New feature or request
lgtm
This PR has been approved by a maintainer
PR - Needs Review
size:L
This PR changes 100-499 lines, ignoring generated files.
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.
Description
Closes #3967, #4524
This PR adds Google Gemini as a new embedding provider for codebase indexing, expanding the available options beyond OpenAI and Ollama. The implementation leverages Gemini's text-embedding-004 model through their OpenAI-compatible API endpoint.
Technical Architecture Decision
Why OpenAI-Compatible API Instead of Native Gemini Client?
We implemented GeminiEmbedder as a wrapper around OpenAICompatibleEmbedder rather than using the native Gemini/GenAI client due to significant performance limitations:
This architectural choice prioritizes user experience while maintaining full compatibility with Gemini's powerful text-embedding-004 model.
Changes Made
Backend Implementation
src/services/code-index/embedders/gemini.ts) - Optimized wrapper around OpenAICompatibleEmbedder with Gemini-specific configuration:https://generativelanguage.googleapis.com/v1beta/openai/text-embedding-004src/services/code-index/service-factory.ts) - Added Gemini provider supportsrc/services/code-index/config-manager.ts) - Added Gemini configuration handlingpackages/types/src/global-settings.ts,packages/types/src/codebase-index.ts) - Added Gemini provider typesFrontend Implementation
webview-ui/src/components/settings/CodeIndexSettings.tsx) - Added Gemini to provider dropdownInternationalization
Testing
src/services/code-index/embedders/__tests__/gemini.spec.ts) - Tests for GeminiEmbedder functionalityTesting
Verification of Acceptance Criteria
Based on issue #4524 acceptance criteria:
Related Issues
User Experience
Users can now:
The implementation provides a seamless experience with automatic configuration of Gemini's optimal settings and significantly improved performance compared to the native client approach.
Performance Benefits
Checklist
Important
Adds Gemini embedding provider for codebase indexing using OpenAI-compatible API, with backend, frontend, i18n, and testing updates.
GeminiEmbedderclass ingemini.tsusing OpenAI-compatible API for codebase indexing.text-embedding-004model with fixed dimension 768.service-factory.tsandconfig-manager.tsto include Gemini provider.CodeIndexSettings.tsxto add Gemini to provider dropdown.gemini.spec.ts.config-manager.spec.tsandservice-factory.spec.tsfor Gemini support.This description was created by
for dfc844e. You can customize this summary. It will automatically update as commits are pushed.