Spaces:
Sleeping
Sleeping
File size: 1,615 Bytes
224c593 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
#!/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()) |