File size: 1,242 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
#!/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())