Update app.py
Browse files
app.py
CHANGED
|
@@ -50,9 +50,17 @@ def process_upload(files):
|
|
| 50 |
path="./qdrant_db",
|
| 51 |
prefer_grpc=True
|
| 52 |
)
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
vector_store = QdrantVectorStore(
|
| 55 |
-
collection_name=
|
| 56 |
client=client,
|
| 57 |
enable_hybrid=True,
|
| 58 |
batch_size=20,
|
|
|
|
| 50 |
path="./qdrant_db",
|
| 51 |
prefer_grpc=True
|
| 52 |
)
|
| 53 |
+
existing_collections = {col.name for col in client.get_collections().collections}
|
| 54 |
+
if collection_name not in existing_collections:
|
| 55 |
+
client.create_collection(
|
| 56 |
+
collection_name=collection_name,
|
| 57 |
+
vectors_config=models.VectorParams(
|
| 58 |
+
size=1536,
|
| 59 |
+
distance=models.Distance.COSINE
|
| 60 |
+
)
|
| 61 |
+
)
|
| 62 |
vector_store = QdrantVectorStore(
|
| 63 |
+
collection_name=collection_name,
|
| 64 |
client=client,
|
| 65 |
enable_hybrid=True,
|
| 66 |
batch_size=20,
|