Team Ai
Apppublic

NaimalcreativityAI/physical-ai-chatbot-api

sourceHugging Facemitupdated 10mo agoView on Hugging Face
0likes
test_qdrant.py57 linesDownload Raw Back to scripts
1"""2Test Qdrant connection.3Verifies that Qdrant credentials are correct and connection works.4 5Usage:6    python scripts/test_qdrant.py7"""8import sys9from pathlib import Path10 11# Add parent directory to path to import src package12sys.path.insert(0, str(Path(__file__).parent.parent))13 14from qdrant_client import QdrantClient15from src.config.settings import settings16 17 18def main():19    """Test Qdrant connection."""20    print("="* 60)21    print("Testing Qdrant Connection")22    print("="* 60)23 24    print(f"\nQdrant URL: {settings.qdrant_url}")25    print(f"Collection: {settings.collection_name}")26 27    try:28        # Initialize client29        client = QdrantClient(30            url=settings.qdrant_url,31            api_key=settings.qdrant_api_key32        )33 34        # Get collections35        collections = client.get_collections()36        print(f"\n✓ Connection successful!", collections)37        print(f"  Available collections: {len(collections.collections)}")38 39        for collection in collections.collections:40            print(f"    - {collection.name}")41 42        print("\n" + "="* 60)43        print("✓ Qdrant connection test passed!")44        print("="* 60)45 46    except Exception as e:47        print(f"\n✗ Connection failed: {str(e)}")48        print("\nPlease check:")49        print("  1. QDRANT_URL is correct in .env")50        print("  2. QDRANT_API_KEY is correct in .env")51        print("  3. Network connection is available")52        sys.exit(1)53 54 55if __name__ == "__main__":56    main()57