mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-11-30 17:13:15 +00:00
Backend
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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user