Team Ai
Apppublic

Samra09/Physical_AI_Humanoid_Robotics

sourceHugging Faceupdated 10mo agoView on Hugging Face
0likes
debug_chat.py55 linesDownload Raw Back to root
1 2import sys3import os4import logging5 6# Ensure we can import from src7sys.path.append(os.getcwd())8 9from src.config import settings10from src.services.rag_service import rag_service11from src.services.qdrant_service import qdrant_service12 13logging.basicConfig(level=logging.INFO)14logger = logging.getLogger("debug")15 16def debug_chat():17    print("--- Debugging Chat ---")18    19    # 1. Check Qdrant Collection Status20    print("\n1. Checking Qdrant Collection...")21    try:22        collections = qdrant_service.client.get_collections()23        collection_names = [c.name for c in collections.collections]24        print(f"   Available Collections: {collection_names}")25        26        target_col = settings.vector_collection_name27        if target_col in collection_names:28            print(f"   โœ… Collection '{target_col}' exists.")29            # Check count30            count = qdrant_service.client.count(target_col)31            print(f"   ๐Ÿ“Š Items in collection: {count.count}")32        else:33            print(f"   โŒ Collection '{target_col}' DOES NOT EXIST.")34    except Exception as e:35        print(f"   โŒ Error checking collection: {e}")36 37    # 2. Try RAG Query38    print("\n2. Testing RAG Query...")39    print(f"DEBUG: Client type: {type(qdrant_service.client)}")40    print(f"DEBUG: Client dir: {dir(qdrant_service.client)}")41    try:42        result = rag_service.robust_query("hi")43        print(f"   Result: {result}")44        if result.get("error"):45            print(f"   โŒ Query returned error: {result['error']}")46        else:47            print("   โœ… Query successful.")48    except Exception as e:49        print(f"   โŒ Query crashed: {e}")50        import traceback51        traceback.print_exc()52 53if __name__ == "__main__":54    debug_chat()55