File size: 1,114 Bytes
35d7369
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from qdrant_client import QdrantClient
from qdrant_client.http import models
from dotenv import load_dotenv
import os

# Load environment variables
load_dotenv()

# Initialize Qdrant client
qdrant_api_key = os.getenv("QDRANT_API_KEY")
qdrant_client = QdrantClient(
    url="https://9266da83-dbfe-48d6-b2d8-cdf101299284.europe-west3-0.gcp.cloud.qdrant.io",
    api_key=qdrant_api_key
)

# Define your collection name
COLLECTION_NAME = "ai_info_collection"

try:
    # Delete all points in the collection
    qdrant_client.delete(
        collection_name=COLLECTION_NAME,
        points_selector=models.FilterSelector(filter=models.Filter())
    )
    print(f"All points in collection '{COLLECTION_NAME}' have been deleted.")

    # Delete processed_docs.json file
    processed_docs_path = os.path.join(os.path.dirname(__file__), 'processed_docs.json')
    if os.path.exists(processed_docs_path):
        os.remove(processed_docs_path)
        print("processed_docs.json has been deleted.")
    else:
        print("processed_docs.json does not exist.")

except Exception as e:
    print(f"An error occurred: {e}")