Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/services/code-index/__tests__/service-factory.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ describe("CodeIndexServiceFactory", () => {
qdrantApiKey: "test-key",
}
mockConfigManager.getConfig.mockReturnValue(testConfig as any)
mockGetModelDimension.mockReturnValue(3072)
mockGetModelDimension.mockReturnValue(768)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These test changes assume 768 dimensions for gemini-embedding-001, but this appears to be incorrect based on the issue reporter's feedback. The tests were correctly expecting 3072 dimensions before.

Changing tests to match incorrect assumptions could mask the real issue and make it harder to detect problems in the future.


// Act
factory.createVectorStore()
Expand All @@ -576,7 +576,7 @@ describe("CodeIndexServiceFactory", () => {
expect(MockedQdrantVectorStore).toHaveBeenCalledWith(
"/test/workspace",
"http://localhost:6333",
3072,
768,
"test-key",
)
})
Expand All @@ -590,7 +590,7 @@ describe("CodeIndexServiceFactory", () => {
}
mockConfigManager.getConfig.mockReturnValue(testConfig as any)
mockGetDefaultModelId.mockReturnValue("gemini-embedding-001")
mockGetModelDimension.mockReturnValue(3072)
mockGetModelDimension.mockReturnValue(768)

// Act
factory.createVectorStore()
Expand All @@ -601,7 +601,7 @@ describe("CodeIndexServiceFactory", () => {
expect(MockedQdrantVectorStore).toHaveBeenCalledWith(
"/test/workspace",
"http://localhost:6333",
3072,
768,
"test-key",
)
})
Expand Down
2 changes: 1 addition & 1 deletion src/services/code-index/embedders/gemini.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { TelemetryService } from "@roo-code/telemetry"
*
* Supported models:
* - text-embedding-004 (dimension: 768)
* - gemini-embedding-001 (dimension: 2048)
* - gemini-embedding-001 (dimension: 768)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This documentation update contradicts both the original configuration (3072) and the issue reporter's explicit feedback. The comment should reflect the actual dimension of the model.

Additionally, the real issue appears to be that 1024-dimensional vectors are being sent to Qdrant, which doesn't match either 768 or 3072. This suggests there might be a different root cause - possibly a model ID mismatch or the wrong model being selected at runtime.

*/
export class GeminiEmbedder implements IEmbedder {
private readonly openAICompatibleEmbedder: OpenAICompatibleEmbedder
Expand Down
2 changes: 1 addition & 1 deletion src/shared/embeddingModels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const EMBEDDING_MODEL_PROFILES: EmbeddingModelProfiles = {
},
gemini: {
"text-embedding-004": { dimension: 768 },
"gemini-embedding-001": { dimension: 3072, scoreThreshold: 0.4 },
"gemini-embedding-001": { dimension: 768, scoreThreshold: 0.4 },
Copy link
Contributor Author

Choose a reason for hiding this comment

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

🚨 Critical Issue: This change appears to be incorrect. The issue reporter explicitly stated that "gemini-embedding-001 should be 3072" and that this fix is "actually breaking the wrong thing".

The original configuration had this model at 3072 dimensions, which aligns with the issue reporter's feedback. Changing it to 768 would break existing embeddings that were created with 3072 dimensions.

Is this change based on official Google documentation? If so, could we verify the correct dimensions for this specific model?

},
mistral: {
"codestral-embed-2505": { dimension: 1536, scoreThreshold: 0.4 },
Expand Down
Loading