File size: 1,465 Bytes
8828f20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from pymongo import MongoClient
from dotenv import load_dotenv
import os

# # Load environment variables from .env
# load_dotenv()

##-------------##
# FOR QA CLUSTER
##-------------##

# mongo_uri = os.getenv("MONGO_URI")
# if not mongo_uri:
#     raise ValueError("❌ MongoDB URI (MongoURI) is missing!")

# client = MongoClient(mongo_uri)
# db = client["MedicalChatbotDB"]  # Use the same database name as in your main script

# # To drop just the collection storing the FAISS index:
# db.drop_collection("qa_data")
# print("Dropped collection 'qa_data' from MedicalChatbotDB.")

# # Alternatively, to drop the entire database:
# client.drop_database("MedicalChatbotDB")
# print("Dropped database 'MedicalChatbotDB'.")


##-------------##
# FOR INDEX CLUSTER
##-------------##

# Load environment variables from .env
# load_dotenv()
# index_uri = os.getenv("INDEX_URI")
# if not index_uri:
#     raise ValueError("❌ MongoDB URI (IndexURI) is missing!")

# iclient = MongoClient(index_uri)
# idb = iclient["MedicalChatbotDB"]  # Use the same database name as in your main script

# # To drop just the collection storing the FAISS index:
# idb.drop_collection("faiss_index_files.files")
# idb.drop_collection("faiss_index_files.chunks")
# print("Dropped collection 'faiss_index_files' and chunks from MedicalChatbotDB.")

# # Alternatively, to drop the entire database:
# iclient.drop_database("MedicalChatbotDB")
# print("Dropped database 'MedicalChatbotDB'.")