Skip to main content

Table of Contents

Module spoon_ai.memory.utils

Memory helpers shared across Mem0 demos and utilities.

extract_memories​

def extract_memories(result: Any) -> List[str]

Normalize Mem0 search/get responses into a list of memory strings. Supports common shapes: {"memories": [...]}, {"results": [...]}, {"data": [...]}, list, or scalar.

extract_first_memory_id​

def extract_first_memory_id(result: Any) -> Optional[str]

Pull the first memory id from Mem0 responses. Supports common id fields: id, _id, memory_id, uuid.