Skip to content

Commit a1c10fe

Browse files
committed
feat: add Vertex AI as embedder provider for codebase indexing
- Add "vertex" to EmbedderProvider type - Add Vertex AI embedding models (text-embedding-004, text-multilingual-embedding-002, etc.) - Create VertexEmbedder implementation using OpenAI-compatible approach - Update service factory to handle vertex provider - Add vertexOptions to CodeIndexConfig interface - Update CodeIndexPopover UI to include Vertex AI section - Add translation keys for Vertex AI - Add comprehensive tests for VertexEmbedder - Update type definitions to include vertex in codebaseIndexModels Closes #6300
1 parent 1819bd1 commit a1c10fe

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

packages/types/src/codebase-index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ export const CODEBASE_INDEX_DEFAULTS = {
2121
export const codebaseIndexConfigSchema = z.object({
2222
codebaseIndexEnabled: z.boolean().optional(),
2323
codebaseIndexQdrantUrl: z.string().optional(),
24-
codebaseIndexEmbedderProvider: z.enum(["openai", "ollama", "openai-compatible", "gemini", "mistral"]).optional(),
24+
codebaseIndexEmbedderProvider: z
25+
.enum(["openai", "ollama", "openai-compatible", "gemini", "mistral", "vertex"])
26+
.optional(),
2527
codebaseIndexEmbedderBaseUrl: z.string().optional(),
2628
codebaseIndexEmbedderModelId: z.string().optional(),
2729
codebaseIndexEmbedderModelDimension: z.number().optional(),
@@ -48,6 +50,7 @@ export const codebaseIndexModelsSchema = z.object({
4850
"openai-compatible": z.record(z.string(), z.object({ dimension: z.number() })).optional(),
4951
gemini: z.record(z.string(), z.object({ dimension: z.number() })).optional(),
5052
mistral: z.record(z.string(), z.object({ dimension: z.number() })).optional(),
53+
vertex: z.record(z.string(), z.object({ dimension: z.number() })).optional(),
5154
})
5255

5356
export type CodebaseIndexModels = z.infer<typeof codebaseIndexModelsSchema>
@@ -64,6 +67,7 @@ export const codebaseIndexProviderSchema = z.object({
6467
codebaseIndexOpenAiCompatibleModelDimension: z.number().optional(),
6568
codebaseIndexGeminiApiKey: z.string().optional(),
6669
codebaseIndexMistralApiKey: z.string().optional(),
70+
codebaseIndexVertexApiKey: z.string().optional(),
6771
})
6872

6973
export type CodebaseIndexProvider = z.infer<typeof codebaseIndexProviderSchema>

packages/types/src/global-settings.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ export const SECRET_STATE_KEYS = [
184184
"codebaseIndexOpenAiCompatibleApiKey",
185185
"codebaseIndexGeminiApiKey",
186186
"codebaseIndexMistralApiKey",
187+
"codebaseIndexVertexApiKey",
187188
"huggingFaceApiKey",
188189
] as const satisfies readonly (keyof ProviderSettings)[]
189190
export type SecretState = Pick<ProviderSettings, (typeof SECRET_STATE_KEYS)[number]>

webview-ui/src/context/ExtensionStateContext.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode
232232
codebaseIndexSearchMaxResults: undefined,
233233
codebaseIndexSearchMinScore: undefined,
234234
},
235-
codebaseIndexModels: { ollama: {}, openai: {} },
235+
codebaseIndexModels: { ollama: {}, openai: {}, vertex: {} },
236236
alwaysAllowUpdateTodoList: true,
237237
includeDiagnosticMessages: true,
238238
maxDiagnosticMessages: 50,

0 commit comments

Comments
 (0)