From 6445cda35a774a4ae31ef43cb9a1e5aef272c0f7 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 5 Feb 2025 10:46:21 +0000 Subject: [PATCH] fix: Use custom path for memory reset Co-Authored-By: Joe Moura --- src/crewai/memory/storage/rag_storage.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/crewai/memory/storage/rag_storage.py b/src/crewai/memory/storage/rag_storage.py index 7240fe02e..28274dde1 100644 --- a/src/crewai/memory/storage/rag_storage.py +++ b/src/crewai/memory/storage/rag_storage.py @@ -154,7 +154,10 @@ class RAGStorage(BaseRAGStorage): try: if self.app: self.app.reset() - shutil.rmtree(f"{db_storage_path()}/{self.type}") + storage_path = self.path if self.path else db_storage_path() + db_dir = os.path.join(storage_path, self.type) + if os.path.exists(db_dir): + shutil.rmtree(db_dir) self.app = None self.collection = None except Exception as e: