Skip to content

Commit 2cd9acf

Browse files
committed
refactor: remove unused modelDimension parameter from OpenAiCompatibleEmbedder
- Remove modelDimension property and constructor parameter from OpenAiCompatibleEmbedder class - Update ServiceFactory to not pass dimension to embedder constructor - Update tests to match new constructor signature - The dimension is still used for QdrantVectorStore configuration
1 parent 97ec212 commit 2cd9acf

File tree

3 files changed

+1
-34
lines changed

3 files changed

+1
-34
lines changed

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

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -183,34 +183,6 @@ describe("CodeIndexServiceFactory", () => {
183183
"https://api.example.com/v1",
184184
"test-api-key",
185185
testModelId,
186-
undefined,
187-
)
188-
})
189-
190-
it("should pass modelDimension to OpenAI Compatible embedder when provided", () => {
191-
// Arrange
192-
const testModelId = "custom-model"
193-
const testDimension = 1024
194-
const testConfig = {
195-
embedderProvider: "openai-compatible",
196-
modelId: testModelId,
197-
openAiCompatibleOptions: {
198-
baseUrl: "https://api.example.com/v1",
199-
apiKey: "test-api-key",
200-
modelDimension: testDimension,
201-
},
202-
}
203-
mockConfigManager.getConfig.mockReturnValue(testConfig as any)
204-
205-
// Act
206-
factory.createEmbedder()
207-
208-
// Assert
209-
expect(MockedOpenAiCompatibleEmbedder).toHaveBeenCalledWith(
210-
"https://api.example.com/v1",
211-
"test-api-key",
212-
testModelId,
213-
testDimension,
214186
)
215187
})
216188

@@ -234,7 +206,6 @@ describe("CodeIndexServiceFactory", () => {
234206
"https://api.example.com/v1",
235207
"test-api-key",
236208
undefined,
237-
undefined,
238209
)
239210
})
240211

src/services/code-index/embedders/openai-compatible.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,14 @@ import {
1414
export class OpenAiCompatibleEmbedder implements IEmbedder {
1515
private embeddingsClient: OpenAI
1616
private readonly defaultModelId: string
17-
private readonly modelDimension?: number
1817

1918
/**
2019
* Creates a new OpenAI Compatible embedder
2120
* @param baseUrl The base URL for the OpenAI-compatible API endpoint
2221
* @param apiKey The API key for authentication
2322
* @param modelId Optional model identifier (defaults to "text-embedding-3-small")
24-
* @param dimension Optional embedding dimension for the model
2523
*/
26-
constructor(baseUrl: string, apiKey: string, modelId?: string, dimension?: number) {
24+
constructor(baseUrl: string, apiKey: string, modelId?: string) {
2725
if (!baseUrl) {
2826
throw new Error("Base URL is required for OpenAI Compatible embedder")
2927
}
@@ -36,7 +34,6 @@ export class OpenAiCompatibleEmbedder implements IEmbedder {
3634
apiKey: apiKey,
3735
})
3836
this.defaultModelId = modelId || "text-embedding-3-small"
39-
this.modelDimension = dimension
4037
}
4138

4239
/**

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ export class CodeIndexServiceFactory {
5252
config.openAiCompatibleOptions.baseUrl,
5353
config.openAiCompatibleOptions.apiKey,
5454
config.modelId,
55-
config.openAiCompatibleOptions.modelDimension, // Pass the dimension
5655
)
5756
}
5857

0 commit comments

Comments
 (0)