Skip to content

Commit e3111a8

Browse files
committed
Fix MemoryRecord creation in save_working_memory
- Added required 'id' and 'session_id' fields to MemoryRecord - Removed invalid 'metadata' parameter - Added 'event_date' parameter support This fixes the memory notebooks that create MemoryRecord objects when saving working memory with structured memories.
1 parent 20ec0d1 commit e3111a8

File tree

1 file changed

+3
-1
lines changed
  • python-recipes/context-engineering/reference-agent/redis_context_course

1 file changed

+3
-1
lines changed

python-recipes/context-engineering/reference-agent/redis_context_course/memory_client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,15 @@ async def save_working_memory(
119119
for mem in memories:
120120
memory_records.append(
121121
MemoryRecord(
122+
id=str(uuid.uuid4()),
122123
text=mem.get("text", ""),
124+
session_id=session_id,
123125
user_id=self.user_id,
124126
namespace=self.namespace,
125127
memory_type=mem.get("memory_type", "semantic"),
126128
topics=mem.get("topics", []),
127129
entities=mem.get("entities", []),
128-
metadata=mem.get("metadata", {})
130+
event_date=mem.get("event_date")
129131
)
130132
)
131133

0 commit comments

Comments
 (0)