What specific problem does this solve?
Problem: Roo Code currently only supports Google's text-embedding-004 model, which is an older generation of embedding models. Users who want to leverage the newer, more powerful, and potentially more cost-effective gemini-embedding-exp-03-07 model are unable to do so.
Impact: This limits the quality and flexibility of the codebase indexing feature. The new Gemini model offers elastic output dimensions (3072, 1536, 768), allowing users to balance performance and cost, but this capability is currently inaccessible. Developers are forced to use an outdated model, which may not meet their project's requirements.
Additional context (optional)
The gemini-embedding-exp-03-07 model is Google's latest-generation embedding model and is the recommended model for new applications. Adding support for it will ensure Roo Code stays current with the latest AI technologies.
Roo Code Task Links (Optional)
No response
Request checklist
Interested in implementing this?
Implementation requirements
How should this be solved? (REQUIRED if contributing, optional otherwise)
The solution involves adding support for the gemini-embedding-exp-03-07 model and its flexible output dimensions.
- Update Model Definitions: Add model profiles for
gemini-embedding-exp-03-07 with dimensions 3072, 1536, and 768 to src/shared/embeddingModels.ts.
- Update Embedder Logic: Modify the
GeminiEmbedder in src/services/code-index/embedders/gemini.ts to pass the selected outputDimension to the underlying API.
- Update Base Embedder: The
OpenAICompatibleEmbedder will be updated to accept and handle the outputDimension parameter.
- Bug Fix: A related
TypeError in webviewMessageHandler will be fixed by adding a null check for provider.codeIndexManager.
How will we know it works? (Acceptance Criteria - REQUIRED if contributing, optional otherwise)
Given a user wants to configure codebase indexing with the latest Google model
When they navigate to the "Roo-Code: Codebase Indexing Settings"
And select "Gemini" as the Embedder Provider
Then the "Select a model" dropdown should list gemini-embedding-exp-03-07 with options for 3072, 1536, and 768 dimensions.
And the user can select any of these options and save the settings without errors.
But the existing text-embedding-004 model must remain available and fully functional.
Technical considerations (REQUIRED if contributing, optional otherwise)
The implementation will affect the following files:
src/shared/embeddingModels.ts
src/services/code-index/embedders/gemini.ts
src/services/code-index/embedders/openai-compatible.ts
src/core/webview/webviewMessageHandler.ts
src/services/code-index/embedders/__tests__/gemini.spec.ts
Trade-offs and risks (REQUIRED if contributing, optional otherwise)
The primary risk was a potential regression in the webview, which manifested as a TypeError. This has been identified and fixed by adding a null check, making the implementation low-risk. There are no breaking changes, as the existing text-embedding-004 model is preserved.
What specific problem does this solve?
Problem: Roo Code currently only supports Google's
text-embedding-004model, which is an older generation of embedding models. Users who want to leverage the newer, more powerful, and potentially more cost-effectivegemini-embedding-exp-03-07model are unable to do so.Impact: This limits the quality and flexibility of the codebase indexing feature. The new Gemini model offers elastic output dimensions (3072, 1536, 768), allowing users to balance performance and cost, but this capability is currently inaccessible. Developers are forced to use an outdated model, which may not meet their project's requirements.
Additional context (optional)
The
gemini-embedding-exp-03-07model is Google's latest-generation embedding model and is the recommended model for new applications. Adding support for it will ensure Roo Code stays current with the latest AI technologies.Roo Code Task Links (Optional)
No response
Request checklist
Interested in implementing this?
Implementation requirements
How should this be solved? (REQUIRED if contributing, optional otherwise)
The solution involves adding support for the
gemini-embedding-exp-03-07model and its flexible output dimensions.gemini-embedding-exp-03-07with dimensions 3072, 1536, and 768 tosrc/shared/embeddingModels.ts.GeminiEmbedderinsrc/services/code-index/embedders/gemini.tsto pass the selectedoutputDimensionto the underlying API.OpenAICompatibleEmbedderwill be updated to accept and handle theoutputDimensionparameter.TypeErrorinwebviewMessageHandlerwill be fixed by adding a null check forprovider.codeIndexManager.How will we know it works? (Acceptance Criteria - REQUIRED if contributing, optional otherwise)
Given a user wants to configure codebase indexing with the latest Google model
When they navigate to the "Roo-Code: Codebase Indexing Settings"
And select "Gemini" as the Embedder Provider
Then the "Select a model" dropdown should list
gemini-embedding-exp-03-07with options for 3072, 1536, and 768 dimensions.And the user can select any of these options and save the settings without errors.
But the existing
text-embedding-004model must remain available and fully functional.Technical considerations (REQUIRED if contributing, optional otherwise)
The implementation will affect the following files:
src/shared/embeddingModels.tssrc/services/code-index/embedders/gemini.tssrc/services/code-index/embedders/openai-compatible.tssrc/core/webview/webviewMessageHandler.tssrc/services/code-index/embedders/__tests__/gemini.spec.tsTrade-offs and risks (REQUIRED if contributing, optional otherwise)
The primary risk was a potential regression in the webview, which manifested as a
TypeError. This has been identified and fixed by adding a null check, making the implementation low-risk. There are no breaking changes, as the existingtext-embedding-004model is preserved.