From d1a2028f61a19ed2a8d5d5bbdc8d1190c194641c Mon Sep 17 00:00:00 2001 From: Nate Date: Wed, 28 Aug 2024 13:34:20 -0700 Subject: [PATCH] voyage embeddings provider --- core/index.d.ts | 3 ++- .../indexing/embeddings/VoyageEmbeddingsProvider.ts | 13 +++++++++++++ core/indexing/embeddings/index.ts | 2 ++ extensions/vscode/config_schema.json | 8 +++++--- 4 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 core/indexing/embeddings/VoyageEmbeddingsProvider.ts diff --git a/core/index.d.ts b/core/index.d.ts index 93b5db918..cb33505c2 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -777,7 +777,8 @@ export type EmbeddingsProviderName = | "free-trial" | "gemini" | "continue-proxy" - | "deepinfra"; + | "deepinfra" + | "voyage"; export interface EmbedOptions { apiBase?: string; diff --git a/core/indexing/embeddings/VoyageEmbeddingsProvider.ts b/core/indexing/embeddings/VoyageEmbeddingsProvider.ts new file mode 100644 index 000000000..3972b3402 --- /dev/null +++ b/core/indexing/embeddings/VoyageEmbeddingsProvider.ts @@ -0,0 +1,13 @@ +import { EmbeddingsProviderName, EmbedOptions } from "../.."; +import OpenAIEmbeddingsProvider from "./OpenAIEmbeddingsProvider"; + +class VoyageEmbeddingsProvider extends OpenAIEmbeddingsProvider { + static providerName: EmbeddingsProviderName = "voyage"; + + static defaultOptions: Partial | undefined = { + apiBase: "https://api.voyageai.com/v1/", + model: "voyage-code-2", + }; +} + +export default VoyageEmbeddingsProvider; diff --git a/core/indexing/embeddings/index.ts b/core/indexing/embeddings/index.ts index acf3d81e8..acba5dbe2 100644 --- a/core/indexing/embeddings/index.ts +++ b/core/indexing/embeddings/index.ts @@ -9,6 +9,7 @@ import HuggingFaceTEIEmbeddingsProvider from "./HuggingFaceTEIEmbeddingsProvider import OllamaEmbeddingsProvider from "./OllamaEmbeddingsProvider.js"; import OpenAIEmbeddingsProvider from "./OpenAIEmbeddingsProvider.js"; import TransformersJsEmbeddingsProvider from "./TransformersJsEmbeddingsProvider.js"; +import VoyageEmbeddingsProvider from "./VoyageEmbeddingsProvider.js"; type EmbeddingsProviderConstructor = new ( ...args: any[] @@ -27,4 +28,5 @@ export const allEmbeddingsProviders: Record< gemini: GeminiEmbeddingsProvider, "continue-proxy": ContinueProxyEmbeddingsProvider, deepinfra: DeepInfraEmbeddingsProvider, + voyage: VoyageEmbeddingsProvider, }; diff --git a/extensions/vscode/config_schema.json b/extensions/vscode/config_schema.json index 109004403..29bb684e4 100644 --- a/extensions/vscode/config_schema.json +++ b/extensions/vscode/config_schema.json @@ -221,7 +221,8 @@ "### Msty\nMsty is the simplest way to get started with online or local LLMs on all desktop platforms - Windows, Mac, and Linux. No fussing around, one-click and you are up and running. To get started, follow these steps:\n1. Download from [Msty.app](https://msty.app/), open the application, and click 'Setup Local AI'.\n2. Go to the Local AI Module page and download a model of your choice.\n3. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/Msty)", "### IBM watsonx\nwatsonx, developed by IBM, offers a variety of pre-trained AI foundation models that can be used for natural language processing (NLP), computer vision, and speech recognition tasks.", "### OpenRouter\nOpenRouter offers a single API to access almost any language model. To get started, obtain an API key from [their console](https://openrouter.ai/settings/keys).", - "### NVIDIA NIMs\nNVIDIA offers a single API to access almost any language model. To find out more, visit the [LLM APIs Documentation](https://docs.api.nvidia.com/nim/reference/llm-apis).\nFor information specific to getting a key, please check out the [docs here](https://docs.nvidia.com/nim/large-language-models/latest/getting-started.html#option-1-from-api-catalog)" ], + "### NVIDIA NIMs\nNVIDIA offers a single API to access almost any language model. To find out more, visit the [LLM APIs Documentation](https://docs.api.nvidia.com/nim/reference/llm-apis).\nFor information specific to getting a key, please check out the [docs here](https://docs.nvidia.com/nim/large-language-models/latest/getting-started.html#option-1-from-api-catalog)" + ], "type": "string" }, "model": { @@ -2024,7 +2025,8 @@ "openai", "cohere", "free-trial", - "gemini" + "gemini", + "voyage" ] }, "model": { @@ -2055,7 +2057,7 @@ "if": { "properties": { "provider": { - "enum": ["cohere"] + "enum": ["cohere", "voyage"] } }, "required": ["provider"]