Skip to content

armgit / mem0

Public Imported from GitHub
0

The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.

[bug_improvement]: Update hash changed and Vector base class improved (#2034)

Mayank751f5d5a19ab
diff --git a/mem0/memory/main.py b/mem0/memory/main.py
index f0f9cbaee..14f980f27 100644
--- a/mem0/memory/main.py
+++ b/mem0/memory/main.py
@@ -582,7 +582,7 @@ class Memory(MemoryBase):
new_metadata = metadata or {}
new_metadata["data"] = data
- new_metadata["hash"] = existing_memory.payload.get("hash")
+ new_metadata["hash"] = hashlib.md5(data.encode()).hexdigest()
new_metadata["created_at"] = existing_memory.payload.get("created_at")
new_metadata["updated_at"] = datetime.now(pytz.timezone("US/Pacific")).isoformat()
diff --git a/mem0/vector_stores/base.py b/mem0/vector_stores/base.py
index 974f120f9..21f47f3a0 100644
--- a/mem0/vector_stores/base.py
+++ b/mem0/vector_stores/base.py
@@ -38,7 +38,7 @@ class VectorStoreBase(ABC):
pass
@abstractmethod
- def delete_col(self, name):
+ def delete_col(self):
"""Delete a collection."""
pass
@@ -46,3 +46,8 @@ class VectorStoreBase(ABC):
def col_info(self, name):
"""Get information about a collection."""
pass
+
+ @abstractmethod
+ def list(self, filters=None, limit=None):
+ """List all memories."""
+ pass