Dump all conversations from Qdrant storage.
()
| 17 | |
| 18 | |
| 19 | async def dump_qdrant_conversations(): |
| 20 | """Dump all conversations from Qdrant storage.""" |
| 21 | |
| 22 | print("=" * 80) |
| 23 | print("QDRANT CONVERSATION DATABASE DUMP") |
| 24 | print("=" * 80) |
| 25 | |
| 26 | # Get storage configuration |
| 27 | storage_config = CONFIG.conversation_storage |
| 28 | print(f"\nStorage Type: {storage_config.type}") |
| 29 | print(f"Collection Name: {storage_config.collection_name or 'nlweb_conversations'}") |
| 30 | |
| 31 | if storage_config.type != 'qdrant': |
| 32 | print(f"\nWARNING: Storage type is '{storage_config.type}', not 'qdrant'") |
| 33 | print("This script is specifically for Qdrant storage.") |
| 34 | return |
| 35 | |
| 36 | # Initialize Qdrant storage provider |
| 37 | print("\nInitializing Qdrant storage provider...") |
| 38 | storage = QdrantStorageProvider(storage_config) |
| 39 | await storage.initialize() |
| 40 | |
| 41 | # Get collection info |
| 42 | try: |
| 43 | collection_info = await storage.client.get_collection(storage.collection_name) |
| 44 | print("\nCollection Info:") |
| 45 | print(f" Points count: {collection_info.points_count}") |
| 46 | print(f" Vectors size: {collection_info.config.params.vectors.size}") |
| 47 | except Exception as e: |
| 48 | print(f"Error getting collection info: {e}") |
| 49 | return |
| 50 | |
| 51 | # Scroll through all points in the collection |
| 52 | print("\n" + "=" * 80) |
| 53 | print("ALL CONVERSATIONS:") |
| 54 | print("=" * 80) |
| 55 | |
| 56 | try: |
| 57 | # Get all points without any filter |
| 58 | results = await storage.client.scroll( |
| 59 | collection_name=storage.collection_name, |
| 60 | limit=1000, # Get up to 1000 conversations |
| 61 | with_payload=True, |
| 62 | with_vectors=False # Don't include embeddings in output |
| 63 | ) |
| 64 | |
| 65 | points = results[0] |
| 66 | |
| 67 | if not points: |
| 68 | print("\nNo conversations found in the database.") |
| 69 | return |
| 70 | |
| 71 | print(f"\nFound {len(points)} conversation(s)\n") |
| 72 | |
| 73 | # Group by thread_id for better organization |
| 74 | threads = {} |
| 75 | for point in points: |
| 76 | payload = point.payload |
no test coverage detected