From 903c3635cc4a8de196badb082b139078f48c9733 Mon Sep 17 00:00:00 2001 From: Parth Sharma <109902593+parthshr370@users.noreply.github.com> Date: Thu, 27 Nov 2025 23:41:51 +0530 Subject: [PATCH] [docs] Add memory and v2 docs fixup (#3792) --- docs/api-reference/memory/add-memories.mdx | 3 +- .../entity-partitioning-playbook.mdx | 9 ++--- docs/core-concepts/memory-operations/add.mdx | 3 +- docs/integrations/pipecat.mdx | 2 -- docs/platform/features/contextual-add.mdx | 33 +++++++++---------- .../features/entity-scoped-memory.mdx | 6 ++-- 6 files changed, 22 insertions(+), 34 deletions(-) diff --git a/docs/api-reference/memory/add-memories.mdx b/docs/api-reference/memory/add-memories.mdx index 70bae11fe..004fcc73e 100644 --- a/docs/api-reference/memory/add-memories.mdx +++ b/docs/api-reference/memory/add-memories.mdx @@ -44,13 +44,12 @@ Provide at least one message or direct memory string. Most callers supply `messa | --- | --- | --- | --- | | `user_id` | string | No* | Associates the memory with a user. Provide when you want the memory scoped to a specific identity. | | `messages` | array | No* | Conversation turns for Mem0 to infer memories from. Each object should include `role` and `content`. | -| `memory` | string | No* | Direct memory text when you do not need inference. | | `metadata` | object | Optional | Custom key/value metadata (e.g., `{"topic": "preferences"}`). | | `infer` | boolean (default `true`) | Optional | Set to `false` to skip inference and store the provided text as-is. | | `async_mode` | boolean (default `true`) | Optional | Controls asynchronous processing. Most clients leave this enabled. | | `output_format` | string (default `v1.1`) | Optional | Response format. `v1.1` wraps results in a `results` array. | -> \* Provide either `messages` or `memory` to describe what you are storing. For scoped memories, include `user_id`. You can also attach `agent_id`, `app_id`, `run_id`, `project_id`, or `org_id` to refine ownership. +> \* Provide at least one `messages` entry to describe what you are storing. For scoped memories, include `user_id`. You can also attach `agent_id`, `app_id`, `run_id`, `project_id`, or `org_id` to refine ownership. ## Response diff --git a/docs/cookbooks/essentials/entity-partitioning-playbook.mdx b/docs/cookbooks/essentials/entity-partitioning-playbook.mdx index 1247a5e30..6511d95a2 100644 --- a/docs/cookbooks/essentials/entity-partitioning-playbook.mdx +++ b/docs/cookbooks/essentials/entity-partitioning-playbook.mdx @@ -34,8 +34,7 @@ result = client.add( user_id="traveler_cam", agent_id="travel_planner", run_id="tokyo-2025-weekend", - app_id="concierge_app", - version="v2" + app_id="concierge_app" ) ``` @@ -105,8 +104,7 @@ client.add( user_id="traveler_cam", agent_id="chef_recommender", run_id="menu-planning-2025-04", - app_id="concierge_app", - version="v2" + app_id="concierge_app" ) ``` @@ -200,8 +198,7 @@ client.add( user_id="exec_123", agent_id="booking_assistant", app_id="enterprise_portal", - run_id="trip-2025-03", - version="v2" + run_id="trip-2025-03" ) # Retrieve with the same scope diff --git a/docs/core-concepts/memory-operations/add.mdx b/docs/core-concepts/memory-operations/add.mdx index 1a39d6fa9..43d478f8f 100644 --- a/docs/core-concepts/memory-operations/add.mdx +++ b/docs/core-concepts/memory-operations/add.mdx @@ -70,7 +70,6 @@ messages = [ client.add( messages=messages, user_id="alice", - ) ``` @@ -87,7 +86,7 @@ const messages = [ await client.add({ messages, user_id: "alice", - version: "v2" + version: "v2", }); ``` diff --git a/docs/integrations/pipecat.mdx b/docs/integrations/pipecat.mdx index ef6ca3a9a..6cdb05b41 100644 --- a/docs/integrations/pipecat.mdx +++ b/docs/integrations/pipecat.mdx @@ -190,7 +190,6 @@ memory = Mem0MemoryService( params={ "search_limit": 5, # Retrieve up to 5 memories "search_threshold": 0.2, # Higher threshold for more relevant matches - "api_version": "v2", # Mem0 API version } ) ``` @@ -219,4 +218,3 @@ memory = Mem0MemoryService( Create conversational voice agents - diff --git a/docs/platform/features/contextual-add.mdx b/docs/platform/features/contextual-add.mdx index 481193910..ce3d9dbce 100644 --- a/docs/platform/features/contextual-add.mdx +++ b/docs/platform/features/contextual-add.mdx @@ -15,7 +15,7 @@ messages = [ {"role": "assistant", "content": "Great! I'll remember your preference for Italian cuisine."} ] -client.add(messages, user_id="user123", version="v2") +client.add(messages, user_id="user123") ``` ```javascript JavaScript @@ -48,14 +48,14 @@ messages1 = [ {"role": "user", "content": "Hi, I'm Sarah from New York"}, {"role": "assistant", "content": "Hello Sarah! Nice to meet you."} ] -client.add(messages1, user_id="sarah", version="v2") +client.add(messages1, user_id="sarah") # Later interaction - just send new messages messages2 = [ {"role": "user", "content": "I'm planning a trip to Italy next month"}, {"role": "assistant", "content": "How exciting! Italy is beautiful this time of year."} ] -client.add(messages2, user_id="sarah", version="v2") +client.add(messages2, user_id="sarah") # Mem0 automatically knows Sarah is from New York and can use this context ``` @@ -93,7 +93,7 @@ messages = [ {"role": "assistant", "content": "I've noted your allergies for future reference."} ] -client.add(messages, user_id="user123", version="v2") +client.add(messages, user_id="user123") # This allergy info will be available in ALL future interactions ``` @@ -120,21 +120,21 @@ messages1 = [ {"role": "user", "content": "I want to plan a 5-day trip to Tokyo"}, {"role": "assistant", "content": "Perfect! Let's plan your Tokyo adventure."} ] -client.add(messages1, user_id="user123", run_id="tokyo-trip-2024", version="v2") +client.add(messages1, user_id="user123", run_id="tokyo-trip-2024") # Later in the same trip planning session messages2 = [ {"role": "user", "content": "I prefer staying near Shibuya"}, {"role": "assistant", "content": "Great choice! Shibuya is very convenient."} ] -client.add(messages2, user_id="user123", run_id="tokyo-trip-2024", version="v2") +client.add(messages2, user_id="user123", run_id="tokyo-trip-2024") # Different session for work project (separate context) work_messages = [ {"role": "user", "content": "Let's discuss the Q4 marketing strategy"}, {"role": "assistant", "content": "Sure! What are your main goals for Q4?"} ] -client.add(work_messages, user_id="user123", run_id="q4-marketing", version="v2") +client.add(work_messages, user_id="user123", run_id="q4-marketing") ``` ```javascript JavaScript @@ -176,8 +176,7 @@ messages = [ # Each support ticket gets its own run_id client.add(messages, user_id="customer123", - run_id="ticket-2024-001", - version="v2" + run_id="ticket-2024-001" ) ``` @@ -189,7 +188,7 @@ preference_messages = [ {"role": "assistant", "content": "Got it! I'll keep your fitness and dietary preferences in mind."} ] -client.add(preference_messages, user_id="user456", version="v2") +client.add(preference_messages, user_id="user456") # Daily planning session (session-specific) planning_messages = [ @@ -199,8 +198,7 @@ planning_messages = [ client.add(planning_messages, user_id="user456", - run_id="daily-plan-2024-01-15", - version="v2" + run_id="daily-plan-2024-01-15" ) ``` @@ -212,7 +210,7 @@ profile_messages = [ {"role": "assistant", "content": "I'll tailor explanations to help with math concepts."} ] -client.add(profile_messages, user_id="student789", version="v2") +client.add(profile_messages, user_id="student789") # Specific lesson session lesson_messages = [ @@ -222,8 +220,7 @@ lesson_messages = [ client.add(lesson_messages, user_id="student789", - run_id="algorithms-lesson-1", - version="v2" + run_id="algorithms-lesson-1" ) ``` @@ -238,17 +235,17 @@ client.add(lesson_messages, ### ❌ Don't - Send duplicate messages or interaction history -- Forget to include `version="v2"` parameter +- Skip identifiers like `user_id` or `run_id` that scope the memory - Mix contextual and non-contextual approaches in the same application ## Troubleshooting | Issue | Solution | |-------|----------| -| **Context not working** | Ensure you're using `version="v2"` and consistent `user_id` | +| **Context not working** | Ensure each call uses the same `user_id` / `run_id` combo; version is automatic | | **Wrong context retrieved** | Check if you need separate `run_id` values for different interaction topics | | **Missing interaction history** | Verify all messages in the interaction thread use the same `user_id` and `run_id` | | **Too much irrelevant context** | Use more specific `run_id` values to separate different interaction types | - \ No newline at end of file + diff --git a/docs/platform/features/entity-scoped-memory.mdx b/docs/platform/features/entity-scoped-memory.mdx index 4e597c197..b7f09bfcb 100644 --- a/docs/platform/features/entity-scoped-memory.mdx +++ b/docs/platform/features/entity-scoped-memory.mdx @@ -67,8 +67,7 @@ client.add( user_id="teacher_872", agent_id="study_planner", app_id="district_dashboard", - run_id="prep-period-2025-09-02", - version="v2" + run_id="prep-period-2025-09-02" ) ``` @@ -91,8 +90,7 @@ client.add( agent_id="travel_planner", app_id="concierge_portal", run_id="itinerary-2025-apr", - metadata={"category": "preferences"}, - version="v2" + metadata={"category": "preferences"} ) ```