Spaces:
Sleeping
Sleeping
Update qabot.py
Browse files
qabot.py
CHANGED
|
@@ -2,7 +2,8 @@ from langchain_community.llms import CTransformers
|
|
| 2 |
from langchain.prompts import PromptTemplate
|
| 3 |
from langchain_core.runnables import RunnableSequence
|
| 4 |
from langchain.chains import RetrievalQA
|
| 5 |
-
from langchain_community.embeddings import GPT4AllEmbeddings
|
|
|
|
| 6 |
from langchain_community.vectorstores import FAISS
|
| 7 |
|
| 8 |
from huggingface_hub import hf_hub_download
|
|
@@ -58,7 +59,7 @@ def create_qa_chain(prompt, llm, db):
|
|
| 58 |
|
| 59 |
# Load vector DB
|
| 60 |
def read_vector_db():
|
| 61 |
-
embedding_model =
|
| 62 |
return FAISS.load_local(vector_dp_path, embedding_model, allow_dangerous_deserialization=True)
|
| 63 |
|
| 64 |
# Build everything
|
|
|
|
| 2 |
from langchain.prompts import PromptTemplate
|
| 3 |
from langchain_core.runnables import RunnableSequence
|
| 4 |
from langchain.chains import RetrievalQA
|
| 5 |
+
#from langchain_community.embeddings import GPT4AllEmbeddings
|
| 6 |
+
from langchain_community.embeddings import HuggingFaceEmbeddings
|
| 7 |
from langchain_community.vectorstores import FAISS
|
| 8 |
|
| 9 |
from huggingface_hub import hf_hub_download
|
|
|
|
| 59 |
|
| 60 |
# Load vector DB
|
| 61 |
def read_vector_db():
|
| 62 |
+
embedding_model = HuggingFaceEmbeddings(model_file = "sentence-transformers/all-MiniLM-L6-v2")
|
| 63 |
return FAISS.load_local(vector_dp_path, embedding_model, allow_dangerous_deserialization=True)
|
| 64 |
|
| 65 |
# Build everything
|