From 816039036d480c340ec8577a8ea22f7717807278 Mon Sep 17 00:00:00 2001
From: Prateek Chhikara <46902268+prateekchhikara@users.noreply.github.com>
Date: Thu, 22 May 2025 12:07:18 -0700
Subject: [PATCH] Improve documentation on role-based memory attribution rules
(#2770)
---
docs/platform/quickstart.mdx | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/docs/platform/quickstart.mdx b/docs/platform/quickstart.mdx
index 2e6961b0..b2fbb8f0 100644
--- a/docs/platform/quickstart.mdx
+++ b/docs/platform/quickstart.mdx
@@ -142,7 +142,20 @@ curl -X POST "https://api.mem0.ai/v1/memories/" \
- When using `user_id`, only memories from messages with `"role": "user"` are stored. Messages from the assistant are excluded. When using `agent_id`, only memories from messages with `"role": "assistant"` are stored. If you provide both `user_id` and `agent_id` in the same call, each message will be stored with the appropriate ID based on its role. This role-based separation prevents the memories of one role from influencing the memories of a different role, ensuring cleaner and more reliable memory management.
+ When passing `user_id`, memories are primarily created based on user messages, but may be influenced by assistant messages for contextual understanding. For example, in a conversation about food preferences, both the user's stated preferences and their responses to the assistant's questions would form user memories. Similarly, when using `agent_id`, assistant messages are prioritized, but user messages might influence the agent's memories based on context. This approach ensures comprehensive memory creation while maintaining appropriate attribution to either users or agents.
+
+ **Example:**
+ ```
+ User: My favorite cuisine is Italian
+ Assistant: Nice! What about Indian cuisine?
+ User: Don't like it much since I cannot eat spicy food
+
+ Resulting user memories:
+ memory1 - Likes Italian food
+ memory2 - Doesn't like Indian food since cannot eat spicy
+
+ (memory2 comes from user's response about Indian cuisine)
+ ```
Metadata allows you to store structured information (location, timestamp, user state) with memories. Add it during creation to enable precise filtering and retrieval during searches.