File size: 1,107 Bytes
266d7bc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import asyncio

from src.infrastructure.qdrant.qdrant_vectorstore import AsyncQdrantVectorStore
from src.utils.logger_util import setup_logging

logger = setup_logging()


async def main() -> None:
    """Delete the Qdrant collection.

    Initializes an AsyncQdrantVectorStore and deletes its associated collection.
    Logs errors and ensures proper execution.

    Args:
        None

    Returns:
        None

    Raises:
        RuntimeError: If an error occurs during collection deletion.
        Exception: For unexpected errors during execution.

    """
    logger.info("Deleting Qdrant collection")
    try:
        vectorstore = AsyncQdrantVectorStore()
        await vectorstore.delete_collection()
        logger.info("Qdrant collection deleted successfully")
    except RuntimeError as e:
        logger.error(f"Failed to delete Qdrant collection: {e}")
        raise RuntimeError("Error deleting Qdrant collection") from e
    except Exception as e:
        logger.error(f"Unexpected error deleting Qdrant collection: {e}")
        raise


if __name__ == "__main__":
    asyncio.run(main())