Spaces:
Runtime error
Runtime error
Update helpers.py
Browse files- helpers.py +13 -2
helpers.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
from langchain_community.document_loaders import PyMuPDFLoader, TextLoader
|
| 2 |
-
|
| 3 |
|
| 4 |
def process_file(file):
|
| 5 |
documents = []
|
|
@@ -11,4 +11,15 @@ def process_file(file):
|
|
| 11 |
loader = TextLoader(file)
|
| 12 |
docs = loader.load()
|
| 13 |
documents.extend(docs)
|
| 14 |
-
return documents
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from langchain_community.document_loaders import PyMuPDFLoader, TextLoader
|
| 2 |
+
from langchain_community.vectorstores import Qdrant
|
| 3 |
|
| 4 |
def process_file(file):
|
| 5 |
documents = []
|
|
|
|
| 11 |
loader = TextLoader(file)
|
| 12 |
docs = loader.load()
|
| 13 |
documents.extend(docs)
|
| 14 |
+
return documents
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def add_to_qdrant(documents, embeddings, qdrant_client, collection_name):
|
| 18 |
+
|
| 19 |
+
Qdrant.from_documents(
|
| 20 |
+
documents,
|
| 21 |
+
embeddings,
|
| 22 |
+
url=qdrant_client.url,
|
| 23 |
+
prefer_grpc=True,
|
| 24 |
+
collection_name=collection_name,
|
| 25 |
+
)
|