From 32ebdaef2f67840a72039bad16bbb4b99f007b39 Mon Sep 17 00:00:00 2001 From: Deshraj Yadav Date: Fri, 28 Feb 2025 23:39:59 -0800 Subject: [PATCH] [Bug Fix] Fix issue with chromadb not working with 0.6.0 and onwards (#2279) --- mem0/vector_stores/chroma.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mem0/vector_stores/chroma.py b/mem0/vector_stores/chroma.py index efb9fddb..96cc7440 100644 --- a/mem0/vector_stores/chroma.py +++ b/mem0/vector_stores/chroma.py @@ -105,10 +105,10 @@ class ChromaDB(VectorStoreBase): chromadb.Collection: The created or retrieved collection. """ # Skip creating collection if already exists - collections = self.list_cols() - for collection in collections: - if collection.name == name: - logging.debug(f"Collection {name} already exists. Skipping creation.") + collection_info = self.client.get_collection(name=name) + if collection_info: + logging.debug(f"Collection {name} already exists. Skipping creation.") + return collection_info collection = self.client.get_or_create_collection( name=name,