refac: vector db clients

This commit is contained in:
Timothy J. Baek
2024-09-12 02:00:31 -04:00
parent 4775fe43d8
commit 8be6e16513
3 changed files with 9 additions and 11 deletions

View File

@@ -36,10 +36,10 @@ class ChromaClient:
database=CHROMA_DATABASE,
)
def list_collections(self) -> list[str]:
# List all the collections in the database.
def has_collection(self, collection_name: str) -> bool:
# Check if the collection exists based on the collection name.
collections = self.client.list_collections()
return [collection.name for collection in collections]
return collection_name in [collection.name for collection in collections]
def delete_collection(self, collection_name: str):
# Delete the collection based on the collection name.