Spaces:
Sleeping
Sleeping
| 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() | |