I have removed the hardcoded part for the all-mpnet-base-v2 and substituted it with a separate EMBEDDINGS_PATH variable.
Now the user is able to pre-download the embeddings (similarly to the recomended way with all-mpnet-base-v2) and also leave it to sentence-transformers without needing to touch vectorstore/base.py
This commit is contained in:
Pavel
2025-06-21 16:19:42 +02:00
parent b404162364
commit 7140f2cd70
2 changed files with 5 additions and 10 deletions

View File

@@ -74,17 +74,11 @@ class BaseVectorStore(ABC):
embeddings_name,
openai_api_key=embeddings_key
)
elif embeddings_name == "huggingface_sentence-transformers/all-mpnet-base-v2":
if os.path.exists("./models/all-mpnet-base-v2"):
embedding_instance = EmbeddingsSingleton.get_instance(
embeddings_name = "./models/all-mpnet-base-v2",
)
else:
embedding_instance = EmbeddingsSingleton.get_instance(
embeddings_name,
)
else:
embedding_instance = EmbeddingsSingleton.get_instance(embeddings_name)
model_identifier = embeddings_name
if settings.EMBEDDINGS_PATH and os.path.exists(settings.EMBEDDINGS_PATH):
model_identifier = settings.EMBEDDINGS_PATH
embedding_instance = EmbeddingsSingleton.get_instance(model_identifier)
return embedding_instance