File size: 1,394 Bytes
1c29d49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import requests
import os
from dotenv import load_dotenv

load_dotenv()

QDRANT_URL = os.getenv("QDRANT_URL")
QDRANT_API_KEY = os.getenv("QDRANT_API_KEY")
COLLECTION_NAME = "physical_ai_textbook"

if not QDRANT_URL.startswith("http"):
    QDRANT_URL = f"https://{QDRANT_URL}"
QDRANT_URL = QDRANT_URL.rstrip("/")

HEADERS = {
    "api-key": QDRANT_API_KEY,
    "Content-Type": "application/json"
}

def check_collection():
    print(f"Checking collection: {COLLECTION_NAME} at {QDRANT_URL}")
    url = f"{QDRANT_URL}/collections/{COLLECTION_NAME}"
    response = requests.get(url, headers=HEADERS)
    
    if response.status_code == 200:
        data = response.json()
        print("Collection Info:")
        print(f"Status: {data.get('status')}")
        print(f"Points Count: {data.get('result', {}).get('points_count', 'Unknown')}")
        print(f"Vectors Count: {data.get('result', {}).get('vectors_count', 'Unknown')}")
    else:
        print(f"Error accessing collection: {response.status_code} - {response.text}")

def test_search(query_text="physical ai"):
    print(f"\nTesting search for: '{query_text}'")
    # We need to generate an embedding first, but we can't easily do that here without the full app setup.
    # However, we can check if the collection *has* points first.
    pass

if __name__ == "__main__":
    check_collection()