Spaces:
Sleeping
Sleeping
| #!/usr/bin/env python3 | |
| """ | |
| Check documents in the agentic_chatbot LanceDB database | |
| """ | |
| import os | |
| import sys | |
| # Add the path to access lancedb_service | |
| sys.path.append('/Users/abhishekchoudhary/Abhi Project/Voice_Bot/PensionBot') | |
| # Change to agentic_chatbot directory to use its database | |
| os.chdir('/Users/abhishekchoudhary/Abhi Project/Voice_Bot/agentic_chatbot') | |
| import asyncio | |
| import logging | |
| import lancedb | |
| # Setup logging | |
| logging.basicConfig(level=logging.INFO) | |
| logger = logging.getLogger("check_agentic_docs") | |
| async def check_agentic_documents(): | |
| """Check how many documents are in the agentic_chatbot database""" | |
| try: | |
| logger.info("π Checking agentic_chatbot LanceDB document count...") | |
| # Connect to the local LanceDB | |
| db = lancedb.connect("lancedb_data") | |
| table_names = db.table_names() | |
| logger.info(f"π Found {len(table_names)} tables in agentic_chatbot database:") | |
| total_documents = 0 | |
| for table_name in table_names: | |
| try: | |
| table = db.open_table(table_name) | |
| count = table.count_rows() | |
| logger.info(f" π {table_name}: {count} documents") | |
| total_documents += count | |
| except Exception as e: | |
| logger.error(f" β Error checking table {table_name}: {e}") | |
| logger.info(f"π Total documents in agentic_chatbot: {total_documents}") | |
| except Exception as e: | |
| logger.error(f"β Error checking documents: {e}") | |
| if __name__ == "__main__": | |
| asyncio.run(check_agentic_documents()) |