anasmkh commited on
Commit
e0ba41e
·
verified ·
1 Parent(s): 05e198a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -4
app.py CHANGED
@@ -60,13 +60,31 @@ def process_upload(files):
60
 
61
  # Build the index and chat engine using Qdrant as the vector store.
62
  global client, vector_store, storage_context, index, query_engine, memory, chat_engine
63
- client = qdrant_client.QdrantClient(location=":memory:")
64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  vector_store = QdrantVectorStore(
66
- collection_name="paper",
67
  client=client,
68
- enable_hybrid=True,
69
- batch_size=20,
70
  )
71
 
72
  storage_context = StorageContext.from_defaults(vector_store=vector_store)
 
60
 
61
  # Build the index and chat engine using Qdrant as the vector store.
62
  global client, vector_store, storage_context, index, query_engine, memory, chat_engine
63
+ # client = qdrant_client.QdrantClient(location=":memory:")
64
 
65
+ # vector_store = QdrantVectorStore(
66
+ # collection_name="paper",
67
+ # client=client,
68
+ # enable_hybrid=True,
69
+ # batch_size=20,
70
+ # )
71
+ collection_name = ["paper"]
72
+ client = qdrant_client.QdrantClient(
73
+ path="./qdrant_db",
74
+ prefer_grpc=True
75
+ )
76
+ existing_collections = {col.name for col in client.get_collections().collections}
77
+ if collection_name not in existing_collections:
78
+ client.create_collection(
79
+ collection_name=collection_name,
80
+ vectors_config=models.VectorParams(
81
+ size=1536,
82
+ distance=models.Distance.COSINE
83
+ )
84
+ )
85
  vector_store = QdrantVectorStore(
 
86
  client=client,
87
+ collection_name=collection_name,
 
88
  )
89
 
90
  storage_context = StorageContext.from_defaults(vector_store=vector_store)