diff --git a/docs/cookbooks/essentials/controlling-memory-ingestion.mdx b/docs/cookbooks/essentials/controlling-memory-ingestion.mdx index 8bcba6e05..19bdacaf4 100644 --- a/docs/cookbooks/essentials/controlling-memory-ingestion.mdx +++ b/docs/cookbooks/essentials/controlling-memory-ingestion.mdx @@ -319,10 +319,25 @@ Metadata: {'verified': True, 'updated_date': '2025-04-02'} - No duplicate or contradicting memories - Single source of truth for each fact + +That “no duplicates” promise comes from the inference pipeline. Keep `infer=True` when you rely on automatic updates. Raw imports (`infer=False`) skip conflict checks, so mixing the two modes for the same fact will create duplicates. + + **Maintains relationships:** - If using graph memory, connections to other entities persist +### Pick the right inference mode + +| Mode | What it does | Best for | Watch out for | +| --- | --- | --- | --- | +| `infer=True` *(default)* | Runs the LLM pipeline so Mem0 extracts structured facts and resolves conflicts automatically. | Daily conversations, preference tracking, anything you want deduped. | Slightly slower because inference runs on every write. | +| `infer=False` | Stores your payload exactly as-is—no inference, no dedupe. | Bulk imports, compliance snapshots, curated facts you already trust. | Later `infer=True` calls for the same fact will create duplicates you must clean manually. | + + +Stay consistent per data source. If you need both behaviors, keep them in separate scopes (e.g., different `app_id` or `run_id`) so you always know which memories are inferred vs direct imports. + + --- ## Update vs Delete diff --git a/docs/core-concepts/memory-operations/add.mdx b/docs/core-concepts/memory-operations/add.mdx index 0ce8ccea7..1a39d6fa9 100644 --- a/docs/core-concepts/memory-operations/add.mdx +++ b/docs/core-concepts/memory-operations/add.mdx @@ -48,6 +48,10 @@ The resulting memories land in managed vector storage (and optional graph storag + +Duplicate protection only runs during that conflict-resolution step when you let Mem0 infer memories (`infer=True`, the default). If you switch to `infer=False`, Mem0 stores your payload exactly as provided, so duplicates will land. Mixing both modes for the same fact will save it twice. + + You trigger this pipeline with a single `add` call—no manual orchestration needed. ## Add with Mem0 Platform @@ -140,6 +144,10 @@ const result = memory.add(messages, { Use `infer=False` only when you need to store raw transcripts. Most workflows benefit from Mem0 extracting structured memories automatically. + +If you do choose `infer=False`, keep it consistent. Raw inserts skip conflict resolution, so a later `infer=True` call with the same content will create a second memory instead of updating the first. + + ## When Should You Add Memory? Add memory whenever your agent learns something useful: diff --git a/docs/platform/features/direct-import.mdx b/docs/platform/features/direct-import.mdx index 8e4cbf2f8..5217b473f 100644 --- a/docs/platform/features/direct-import.mdx +++ b/docs/platform/features/direct-import.mdx @@ -31,6 +31,10 @@ You can see that the output of the add call is an empty list. Only messages with the role "user" will be used for storage. Messages with roles such as "assistant" or "system" will be ignored during the storage process. + +Direct import skips the inference pipeline, so it also skips duplicate detection. If you later send the same fact with `infer=True`, Mem0 will store a second copy. Pick one mode per memory source unless you truly want both versions. + + ## How to Retrieve Memories You can retrieve memories using the `search` method. @@ -98,4 +102,4 @@ client.get_all(query="What is Alice's favorite sport?", user_id="alice") If you have any questions, please feel free to reach out to us using one of the following methods: - \ No newline at end of file +