allow_reset as constructor argument (#618)

This commit is contained in:
Dev Khant
2023-09-15 19:56:02 +05:30
committed by GitHub
parent a662b2a6c6
commit 01fb216ff7
3 changed files with 10 additions and 9 deletions

View File

@@ -37,6 +37,7 @@ class ChromaDB(BaseVectorDB):
self.config = ChromaDbConfig()
self.settings = Settings()
self.settings.allow_reset = self.config.allow_reset
if self.config.chroma_settings:
for key, value in self.config.chroma_settings.items():
if hasattr(self.settings, key):
@@ -208,8 +209,8 @@ class ChromaDB(BaseVectorDB):
self.client.reset()
except ValueError:
raise ValueError(
"For safety reasons, resetting is disabled."
'Please enable it by including `chromadb_settings={"allow_reset": True}` in your ChromaDbConfig'
"For safety reasons, resetting is disabled. "
"Please enable it by setting `allow_reset=True` in your ChromaDbConfig"
) from None
# Recreate
self._get_or_create_collection(self.config.collection_name)