Skip to content

Commit 44302b0

Browse files
committed
fix: correct Gemini embedding model dimensions
- Fix gemini-embedding-001 dimension from 3072 to 768 in embeddingModels.ts - Update documentation comment in gemini.ts to reflect correct dimension - Update test expectations in service-factory.spec.ts This fixes the vector dimension mismatch error when using Gemini text-embedding-004 with Qdrant, where vectors with incorrect dimensions (1024 or 3072) were being sent to Qdrant which expects 768-dimensional vectors. Fixes #7348
1 parent 8e4c0ae commit 44302b0

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/services/code-index/__tests__/service-factory.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ describe("CodeIndexServiceFactory", () => {
566566
qdrantApiKey: "test-key",
567567
}
568568
mockConfigManager.getConfig.mockReturnValue(testConfig as any)
569-
mockGetModelDimension.mockReturnValue(3072)
569+
mockGetModelDimension.mockReturnValue(768)
570570

571571
// Act
572572
factory.createVectorStore()
@@ -576,7 +576,7 @@ describe("CodeIndexServiceFactory", () => {
576576
expect(MockedQdrantVectorStore).toHaveBeenCalledWith(
577577
"/test/workspace",
578578
"http://localhost:6333",
579-
3072,
579+
768,
580580
"test-key",
581581
)
582582
})
@@ -590,7 +590,7 @@ describe("CodeIndexServiceFactory", () => {
590590
}
591591
mockConfigManager.getConfig.mockReturnValue(testConfig as any)
592592
mockGetDefaultModelId.mockReturnValue("gemini-embedding-001")
593-
mockGetModelDimension.mockReturnValue(3072)
593+
mockGetModelDimension.mockReturnValue(768)
594594

595595
// Act
596596
factory.createVectorStore()
@@ -601,7 +601,7 @@ describe("CodeIndexServiceFactory", () => {
601601
expect(MockedQdrantVectorStore).toHaveBeenCalledWith(
602602
"/test/workspace",
603603
"http://localhost:6333",
604-
3072,
604+
768,
605605
"test-key",
606606
)
607607
})

src/services/code-index/embedders/gemini.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { TelemetryService } from "@roo-code/telemetry"
1111
*
1212
* Supported models:
1313
* - text-embedding-004 (dimension: 768)
14-
* - gemini-embedding-001 (dimension: 2048)
14+
* - gemini-embedding-001 (dimension: 768)
1515
*/
1616
export class GeminiEmbedder implements IEmbedder {
1717
private readonly openAICompatibleEmbedder: OpenAICompatibleEmbedder

src/shared/embeddingModels.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export const EMBEDDING_MODEL_PROFILES: EmbeddingModelProfiles = {
4848
},
4949
gemini: {
5050
"text-embedding-004": { dimension: 768 },
51-
"gemini-embedding-001": { dimension: 3072, scoreThreshold: 0.4 },
51+
"gemini-embedding-001": { dimension: 768, scoreThreshold: 0.4 },
5252
},
5353
mistral: {
5454
"codestral-embed-2505": { dimension: 1536, scoreThreshold: 0.4 },

0 commit comments

Comments
 (0)