#!/usr/bin/env python3 """ Reset the LanceDB database and reload with new diverse content """ import asyncio import logging import shutil import os from pathlib import Path # Setup logging logging.basicConfig(level=logging.INFO) logger = logging.getLogger("reset_db") async def reset_database(): """Reset the database and reload with diverse content""" try: # Path to the database directory db_path = Path("lancedb_data") if db_path.exists(): logger.info("🗑️ Removing existing database...") shutil.rmtree(db_path) logger.info("✅ Existing database removed") # Recreate the database directory db_path.mkdir(exist_ok=True) logger.info("📁 Created new database directory") # Now run the setup documents script logger.info("📚 Loading new diverse documents...") from setup_documents import setup_sample_documents await setup_sample_documents() logger.info("🎉 Database reset complete with diverse content!") except Exception as e: logger.error(f"❌ Error resetting database: {e}") if __name__ == "__main__": asyncio.run(reset_database())