Spaces:
Sleeping
Sleeping
Commit
·
b9112ef
1
Parent(s):
38aeb85
unversioned files
Browse files- app.py +3 -2
- faiss_utils.py +1 -3
app.py
CHANGED
|
@@ -1,8 +1,9 @@
|
|
| 1 |
"""
|
|
|
|
| 2 |
stores vectors in session state, or locally.
|
| 3 |
-
|
| 4 |
-
load function must receive the uploaded file from fileuploader.
|
| 5 |
"""
|
|
|
|
| 6 |
# import time
|
| 7 |
from datetime import datetime
|
| 8 |
# import openai
|
|
|
|
| 1 |
"""
|
| 2 |
+
complete, functional RAG App
|
| 3 |
stores vectors in session state, or locally.
|
| 4 |
+
add function to display retrieved documents
|
|
|
|
| 5 |
"""
|
| 6 |
+
|
| 7 |
# import time
|
| 8 |
from datetime import datetime
|
| 9 |
# import openai
|
faiss_utils.py
CHANGED
|
@@ -3,7 +3,6 @@ from langchain_community.vectorstores import FAISS
|
|
| 3 |
from langchain.embeddings import OpenAIEmbeddings
|
| 4 |
|
| 5 |
|
| 6 |
-
|
| 7 |
def embed(input_strings):
|
| 8 |
vectorstore = FAISS.from_texts(texts=input_strings, embedding=OpenAIEmbeddings())
|
| 9 |
return vectorstore
|
|
@@ -42,6 +41,5 @@ if __name__ == "__main__":
|
|
| 42 |
more_words = ["FAISS", "database", "information", "retrieval"]
|
| 43 |
faiss_db2 = embed(more_words)
|
| 44 |
|
| 45 |
-
# Merge the two vectorstores
|
| 46 |
loaded_db1.merge_from(faiss_db2)
|
| 47 |
-
print("Merged
|
|
|
|
| 3 |
from langchain.embeddings import OpenAIEmbeddings
|
| 4 |
|
| 5 |
|
|
|
|
| 6 |
def embed(input_strings):
|
| 7 |
vectorstore = FAISS.from_texts(texts=input_strings, embedding=OpenAIEmbeddings())
|
| 8 |
return vectorstore
|
|
|
|
| 41 |
more_words = ["FAISS", "database", "information", "retrieval"]
|
| 42 |
faiss_db2 = embed(more_words)
|
| 43 |
|
|
|
|
| 44 |
loaded_db1.merge_from(faiss_db2)
|
| 45 |
+
print("Merged vectorstore with other vectorstore containing total vectors:", loaded_db1.index.ntotal)
|