Skip to content

Commit c98606c

Browse files
committed
Fixing a bug in the default pathing for the memory database for the memory logging RAG capability.
1 parent 6a54fab commit c98606c

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

src/ursa/util/memory_logger.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,9 @@ def __init__(
3232
path: Optional[str | Path] = None,
3333
collection_name: str = "agent_memory",
3434
) -> None:
35+
home_dir = os.path.expanduser("~")
3536
self.path = (
36-
Path(path)
37-
if path
38-
else Path(__file__).resolve().parent / "agent_memory_db"
37+
Path(path) if path else Path(home_dir + "/.cache/ursa/rag/db/")
3938
)
4039
self.collection_name = collection_name
4140
self.path.mkdir(parents=True, exist_ok=True)
@@ -165,8 +164,8 @@ def delete_database(path: Optional[str | Path] = None):
165164
Where the on-disk Chroma DB is for deleting. If *None*, a folder called
166165
``agent_memory_db`` is created in the package’s base directory.
167166
"""
168-
169-
db_path = Path(path) if path else Path("~/.cache/ursa/rag/db/")
167+
home_dir = os.path.expanduser("~")
168+
db_path = Path(path) if path else Path(home_dir + "/.cache/ursa/rag/db/")
170169
if os.path.exists(db_path):
171170
shutil.rmtree(db_path)
172171
print(f"Database: {db_path} has been deleted.")

0 commit comments

Comments
 (0)