An assistant that forgets
Before Mem0 exists, here is the problem it solves. A small support assistant, two conversations, and a customer repeating himself.
The assistant is a dictionary and a loop. It is not a model, and that is on purpose: for the next few lessons the point is the memory, not the answering.
REPLIES = {
"late": "Sorry about that. I can chase order A17 for you.",
"update": "I can send you updates about your order.",
}
def reply(said):
for word, answer in REPLIES.items():
if word in said.lower():
return answer
return "I can help with orders and refunds."
print(reply("My order is late again."))
print(reply("Can you send me an update?"))It answers both. Now run it again tomorrow, which in code means calling it again with nothing carried over.
What it never learns
Ravi said something important in the first conversation: he wants email rather than SMS. Watch what the assistant does with that.
print(reply("I prefer email updates, not SMS."))
print(reply("Can you send me an update?"))The second answer offers to send updates without saying how, because the assistant has no idea what was said one line earlier. Nothing was stored, so nothing could be used.
What is actually needed
You could write this yourself, and people do. The hard parts are not obvious until you start.
- Deciding what is worth keeping. Not every sentence is; thanks! is not a memory.
- Finding it again from a question that uses different words than the memory did.
- Knowing whose memory it is, when one assistant serves thousands of people.
- Handling a fact that changes. He preferred SMS last year and prefers email now.
- Keeping it small, so a year of conversations does not become an unreadable log.
Mem0 is those five things, already written. The next lesson shows what a first attempt gets wrong instead.
- Add a third reply to
REPLIESand check the assistant still forgets everything between calls. - Write down, in one sentence each, three things your own assistant would need to remember about a user.
- Count the lines it would take to store those three things and search them properly.
Little by little, you're building something great.