forked from Davidyz/VectorCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdrop.py
More file actions
22 lines (17 loc) · 771 Bytes
/
Copy pathdrop.py
File metadata and controls
22 lines (17 loc) · 771 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import logging
from chromadb.errors import InvalidCollectionException
from vectorcode.cli_utils import Config
from vectorcode.common import get_client, get_collection
logger = logging.getLogger(name=__name__)
async def drop(config: Config) -> int:
client = await get_client(config)
try:
collection = await get_collection(client, config)
collection_path = collection.metadata["path"]
await client.delete_collection(collection.name)
print(f"Collection for {collection_path} has been deleted.")
logger.info(f"Deteted collection at {collection_path}.")
return 0
except (ValueError, InvalidCollectionException):
logger.error(f"There's no existing collection for {config.project_root}")
return 1