Skip to content

Commit 0e71885

Browse files
committed
Fix MemoryRecord creation to include required id field
The agent-memory-client MemoryRecord model requires an id field. Added uuid generation for memory IDs and removed metadata parameter which isn't a direct field on MemoryRecord.
1 parent 19e671f commit 0e71885

File tree

1 file changed

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

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"""
88

99
import os
10+
import uuid
1011
from typing import List, Dict, Any, Optional
1112
from datetime import datetime
1213

@@ -208,13 +209,13 @@ async def create_memory(
208209
List of created MemoryRecord objects
209210
"""
210211
memory = MemoryRecord(
212+
id=str(uuid.uuid4()),
211213
text=text,
212214
user_id=self.user_id,
213215
namespace=self.namespace,
214216
memory_type=memory_type,
215217
topics=topics or [],
216218
entities=entities or [],
217-
metadata=metadata or {},
218219
event_date=event_date
219220
)
220221

0 commit comments

Comments
 (0)