Spaces:
Sleeping
Sleeping
Update rag.py
Browse filesswitch to ES-CA vectorstore
rag.py
CHANGED
@@ -11,6 +11,8 @@ from langchain_community.embeddings import HuggingFaceEmbeddings
|
|
11 |
class RAG:
|
12 |
NO_ANSWER_MESSAGE: str = "Ho sento, no he pogut respondre la teva pregunta."
|
13 |
|
|
|
|
|
14 |
|
15 |
def __init__(self, hf_token, embeddings_model, model_name):
|
16 |
|
@@ -20,7 +22,7 @@ class RAG:
|
|
20 |
|
21 |
# load vectore store
|
22 |
embeddings = HuggingFaceEmbeddings(model_name=embeddings_model, model_kwargs={'device': 'cpu'})
|
23 |
-
self.vectore_store = FAISS.load_local(
|
24 |
|
25 |
logging.info("RAG loaded!")
|
26 |
|
|
|
11 |
class RAG:
|
12 |
NO_ANSWER_MESSAGE: str = "Ho sento, no he pogut respondre la teva pregunta."
|
13 |
|
14 |
+
vectorstore = "index-intfloat_multilingual-e5-small-500-100-CA-ES" # mixed
|
15 |
+
#vectorstore = "vectorestore" # CA only
|
16 |
|
17 |
def __init__(self, hf_token, embeddings_model, model_name):
|
18 |
|
|
|
22 |
|
23 |
# load vectore store
|
24 |
embeddings = HuggingFaceEmbeddings(model_name=embeddings_model, model_kwargs={'device': 'cpu'})
|
25 |
+
self.vectore_store = FAISS.load_local(vectorstore, embeddings, allow_dangerous_deserialization=True)#, allow_dangerous_deserialization=True)
|
26 |
|
27 |
logging.info("RAG loaded!")
|
28 |
|