Skip to content

Commit d66aa8e

Browse files
author
Your Name
committed
Add support for new Google embedding models and configuration options
- Introduced environment variables for specifying the VertexAI embedding model location and dimension. - Added new supported embedding models for Google Gemini and multilingual embeddings in the backend. - Updated frontend interface to include the new multilingual embedding model from Google.
1 parent 3712dfa commit d66aa8e

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

backend/shared_configs/configs.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,13 @@
7777
os.environ.get("VERTEXAI_EMBEDDING_LOCAL_BATCH_SIZE", "25")
7878
)
7979

80+
VERTEXAI_EMBEDDING_MODEL_LOCATION = os.environ.get("VERTEXAI_EMBEDDING_MODEL_LOCATION", "europe-west1")
81+
82+
# Dimension of the VertexAI embedding model (768 is the default) but for Gemini can be up to 3072.
83+
VERTEXAI_EMBEDDING_MODEL_DIMENSION = int(
84+
os.environ.get("VERTEXAI_EMBEDDING_MODEL_DIMENSION", "768")
85+
)
86+
8087
# Only used for OpenAI
8188
OPENAI_EMBEDDING_TIMEOUT = int(
8289
os.environ.get("OPENAI_EMBEDDING_TIMEOUT", API_BASED_EMBEDDING_TIMEOUT)
@@ -222,6 +229,26 @@ async def async_return_default_schema(*args: Any, **kwargs: Any) -> str:
222229
dim=768,
223230
index_name="danswer_chunk_text_embedding_004",
224231
),
232+
SupportedEmbeddingModel(
233+
name="google/gemini-embedding-001",
234+
dim=768,
235+
index_name="danswer_chunk_google_gemini_embedding_001",
236+
),
237+
SupportedEmbeddingModel(
238+
name="google/gemini-embedding-001",
239+
dim=768,
240+
index_name="danswer_chunk_gemini_embedding_001",
241+
),
242+
SupportedEmbeddingModel(
243+
name="google/text-multilingual-embedding-002",
244+
dim=768,
245+
index_name="danswer_chunk_google_multilingual_embedding_002",
246+
),
247+
SupportedEmbeddingModel(
248+
name="google/text-multilingual-embedding-002",
249+
dim=768,
250+
index_name="danswer_chunk_multilingual_embedding_002",
251+
),
225252
SupportedEmbeddingModel(
226253
name="google/textembedding-gecko@003",
227254
dim=768,

web/src/components/embedding/interfaces.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,19 @@ export const AVAILABLE_CLOUD_PROVIDERS: CloudEmbeddingProvider[] = [
291291
api_key: null,
292292
api_url: null,
293293
},
294+
{
295+
provider_type: EmbeddingProvider.GOOGLE,
296+
model_name: "text-multilingual-embedding-002",
297+
description: "Google's most recent multilingual text embedding model.",
298+
pricePerMillion: 0.015,
299+
model_dim: 768,
300+
normalize: false,
301+
query_prefix: "",
302+
passage_prefix: "",
303+
index_name: "",
304+
api_key: null,
305+
api_url: null,
306+
},
294307
{
295308
provider_type: EmbeddingProvider.GOOGLE,
296309
model_name: "textembedding-gecko@003",

0 commit comments

Comments
 (0)