Update Components/Vector_db.py
Browse files- Components/Vector_db.py +3 -2
Components/Vector_db.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import streamlit as st
|
2 |
-
from langchain.vectorstores import FAISS
|
|
|
3 |
# from langchain.chat_models import ChatOpenAI
|
4 |
# from langchain.memory import ConversationBufferMemory
|
5 |
# from langchain.chains import ConversationalRetrievalChain
|
@@ -16,7 +17,7 @@ def save_vector_store(text_chunks,embeddings):
|
|
16 |
# embeddings = model.encode(raw_text)
|
17 |
# embeddings = HuggingFaceInstructEmbeddings()
|
18 |
vectorstore = FAISS.from_texts(texts=text_chunks, embedding=embeddings)
|
19 |
-
new_db = FAISS.load_local("faiss_index_V2", embeddings)
|
20 |
new_db.merge_from(vectorstore)
|
21 |
new_db.save_local('faiss_index_V2')
|
22 |
|
|
|
1 |
import streamlit as st
|
2 |
+
# from langchain.vectorstores import FAISS
|
3 |
+
from langchain_community.vectorstores import FAISS
|
4 |
# from langchain.chat_models import ChatOpenAI
|
5 |
# from langchain.memory import ConversationBufferMemory
|
6 |
# from langchain.chains import ConversationalRetrievalChain
|
|
|
17 |
# embeddings = model.encode(raw_text)
|
18 |
# embeddings = HuggingFaceInstructEmbeddings()
|
19 |
vectorstore = FAISS.from_texts(texts=text_chunks, embedding=embeddings)
|
20 |
+
new_db = FAISS.load_local("faiss_index_V2", embeddings,allow_dangerous_deserialization=True)
|
21 |
new_db.merge_from(vectorstore)
|
22 |
new_db.save_local('faiss_index_V2')
|
23 |
|