visaverse-chatbot / clear_db.py
shakauthossain's picture
Updated DATABASE Cleanup Function
728520f
raw
history blame contribute delete
612 Bytes
import os
from dotenv import load_dotenv
load_dotenv('.env')
from pymilvus import connections, utility
# Connect to Milvus
connections.connect(
uri=os.getenv('ZILLIZ_URI'),
token=os.getenv('ZILLIZ_TOKEN')
)
collection_name = os.getenv('ZILLIZ_COLLECTION', 'visaverse_faqs3')
# Drop the old collection to start fresh
if utility.has_collection(collection_name):
utility.drop_collection(collection_name)
print(f"โœ… Dropped old collection '{collection_name}'")
print("๐Ÿ”„ Restart the chatbot to reload with fresh IRCC data")
else:
print(f"Collection '{collection_name}' doesn't exist")