File size: 392 Bytes
12003d8
a5d886c
12003d8
 
a5d886c
12003d8
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
memory_store: dict[str, list[str]] = {}

def get_memory(session_id: str) -> str:
    return "\n".join(memory_store.get(session_id, []))

def save_memory(session_id: str, user: str, assistant: str):
    if session_id not in memory_store:
        memory_store[session_id] = []

    memory_store[session_id].append(f"User: {user}")
    memory_store[session_id].append(f"Assistant: {assistant}")