Skip to content

Commit 4c6b1c1

Browse files
committed
fix: add _parse_list_field to base adapter; tests now pass including recency and adapter paths
1 parent a633044 commit 4c6b1c1

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

agent_memory_server/vectorstore_adapter.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,20 @@ async def count_memories(
261261
"""
262262
pass
263263

264+
def _parse_list_field(self, field_value):
265+
"""Parse a field that might be a list, comma-separated string, or None.
266+
267+
Centralized here so both LangChain and Redis adapters can normalize
268+
metadata fields like topics/entities/extracted_from.
269+
"""
270+
if not field_value:
271+
return []
272+
if isinstance(field_value, list):
273+
return field_value
274+
if isinstance(field_value, str):
275+
return field_value.split(",") if field_value else []
276+
return []
277+
264278
def memory_to_document(self, memory: MemoryRecord) -> Document:
265279
"""Convert a MemoryRecord to a LangChain Document.
266280

0 commit comments

Comments
 (0)