diff --git a/docs/api-reference/memory/search-memories.mdx b/docs/api-reference/memory/search-memories.mdx index c396c3d51..3bbe2a52e 100644 --- a/docs/api-reference/memory/search-memories.mdx +++ b/docs/api-reference/memory/search-memories.mdx @@ -69,12 +69,6 @@ related_memories = client.search( "category": "hobbies" }, "score": 0.82, - "score_breakdown": { - "semantic": 0.79, - "bm25": 0.0, - "entity": 0.0, - "temporal_boost": 0.0 - }, "created_at": "2024-07-26T10:29:36.630547-07:00", "updated_at": null, "categories": ["hobbies"] @@ -103,12 +97,6 @@ results = client.search( "memory": "Finished the Q1 product review on March 10, 2025.", "user_id": "alice", "score": 0.91, - "score_breakdown": { - "semantic": 0.84, - "bm25": 0.0, - "entity": 0.0, - "temporal_boost": 0.07 - }, "memory_type": "event", "event_date": "2025-03-10", "event_start": "2025-03-10", diff --git a/docs/changelog/sdk.mdx b/docs/changelog/sdk.mdx index 1a1a43219..3460ca8dd 100644 --- a/docs/changelog/sdk.mdx +++ b/docs/changelog/sdk.mdx @@ -41,7 +41,7 @@ mode: "wide" **Breaking Changes:** - **`add()` returns ADD-only events** — No more `"UPDATE"` or `"DELETE"` events. Memories accumulate; nothing is overwritten ([#4805](https://github.com/mem0ai/mem0/pull/4805)) - **`search()` default `threshold` is now `0.1`** — Pass `threshold=0.0` for previous behavior ([#4805](https://github.com/mem0ai/mem0/pull/4805)) -- **`search()` `score` is now a combined multi-signal score** — The top-level `score` fuses semantic similarity, BM25 keyword match, entity signals, and compatible temporal boosts into one value. Absolute numbers shift versus the old raw cosine score; retune any hard thresholds against representative queries. Platform V3 responses may also include `score_breakdown` and temporal result fields for compatible queries, so treat those as optional enrichments rather than required keys ([#4805](https://github.com/mem0ai/mem0/pull/4805), [#4836](https://github.com/mem0ai/mem0/pull/4836)) +- **`search()` `score` is now a combined multi-signal score** — The top-level `score` fuses semantic similarity, BM25 keyword match, entity signals, and temporal boosts into one value. Absolute numbers shift versus the old raw cosine score; retune any hard thresholds against representative queries. Platform V3 responses may also include `score_breakdown` and temporal result fields for compatible queries, so treat those as optional enrichments rather than required keys ([#4805](https://github.com/mem0ai/mem0/pull/4805), [#4836](https://github.com/mem0ai/mem0/pull/4836)) - **`search()` default `rerank` is now `False`** — Pass `rerank=True` for previous behavior ([#4805](https://github.com/mem0ai/mem0/pull/4805)) - **`top_k` default changed 100 → 20** in `Memory.get_all()` and `Memory.search()` (sync + async). Pass `top_k=100` explicitly to restore the old behavior ([#4843](https://github.com/mem0ai/mem0/pull/4843)) - **Entity ID validation:** `user_id` / `agent_id` / `run_id` are trimmed; empty-string and whitespace-only values now raise `ValueError` ([#4843](https://github.com/mem0ai/mem0/pull/4843)) diff --git a/docs/migration/oss-to-platform.mdx b/docs/migration/oss-to-platform.mdx index a2f5fefcf..2af242682 100644 --- a/docs/migration/oss-to-platform.mdx +++ b/docs/migration/oss-to-platform.mdx @@ -72,13 +72,13 @@ client = MemoryClient(api_key="m0-...") ``` - Run `client.get_all(filters={"user_id": "test_connection"}, page=1, page_size=1)` to verify your API key works. A healthy response is a paginated envelope like `{"count": 0, "next": null, "previous": null, "results": []}` or the same shape with results. + Run `client.get_all(filters={"user_id": "test_connection"})` to verify your API key works. It should return an empty list or valid results. ### 3. Update Retrieval Calls (Critical) - **Critical Change**: Platform uses V3 endpoints and requires entity filters to be nested inside a `filters` dictionary. + **Critical Change**: Platform uses v2 endpoints that require filtering parameters to be nested inside a `filters` dictionary. @@ -95,10 +95,6 @@ client = MemoryClient(api_key="m0-...") Note: `add()` and `delete()` methods remain unchanged. The `update()` method is not available in Platform - use delete + add pattern instead. - - Platform search stays compatible with the normal `results[]` shape, but V3 may include additional top-level fields such as `score_breakdown`, `memory_type`, `event_date`, and `effective_plan_status` when the platform has structured context for the result. - - @@ -136,11 +132,11 @@ Note: `add()` and `delete()` methods remain unchanged. The `update()` method is ``` ```python Platform (New) - # Get the first page of memories for a user - page = client.get_all(filters={"user_id": "alex"}, page=1, page_size=10) + # Get all memories for a user + memories = client.get_all(filters={"user_id": "alex"}, top_k=10) - # Get the next page - next_page = client.get_all(filters={"user_id": "alex"}, page=2, page_size=10) + # Get memories with pagination + memories = client.get_all(filters={"user_id": "alex"}, top_k=5, offset=10) ``` diff --git a/docs/migration/platform-v2-to-v3.mdx b/docs/migration/platform-v2-to-v3.mdx index 5cb402766..f1cc3e2f0 100644 --- a/docs/migration/platform-v2-to-v3.mdx +++ b/docs/migration/platform-v2-to-v3.mdx @@ -307,6 +307,7 @@ If your application previously read graph relations from the API response (`rela - **V1 and V2 endpoints continue to work.** There is no requirement to migrate to V3 endpoints immediately. - **Existing memories are preserved.** The new algorithm does not modify or re-process previously stored memories. +- **Search response shape is unchanged.** The top-level `score` and `results[]` array are the same; existing code that reads `score` continues to work. What changed is the scoring method behind the number (multi-signal fusion instead of pure cosine), so the absolute values shift even when ranking stays comparable. - **Search remains backward-compatible at the top level.** Existing code that reads `results[]` and `score` continues to work, but V3 can now include extra top-level result fields such as `score_breakdown`, `memory_type`, and temporal fields when available. - **List response shape changed.** `get_all` now returns a paginated envelope (`{count, next, previous, results}`) instead of a bare `{results: [...]}`. Update code that reads `response["results"]` to continue working, or switch to the client SDKs which handle both shapes. diff --git a/docs/platform/features/async-client.mdx b/docs/platform/features/async-client.mdx index 69204120d..60049ee5a 100644 --- a/docs/platform/features/async-client.mdx +++ b/docs/platform/features/async-client.mdx @@ -73,7 +73,7 @@ await client.search("What is Alice's favorite sport?", { filters: { userId: "ali ### Get All -Retrieve a paginated list of memories for a user asynchronously. +Retrieve all memories for a user asynchronously. `get_all()` now requires filters to be specified. @@ -82,27 +82,15 @@ Retrieve a paginated list of memories for a user asynchronously. ```python Python -page = await client.get_all( - filters={"AND": [{"user_id": "alice"}]}, - page=1, - page_size=50, -) +await client.get_all(filters={"AND": [{"user_id": "alice"}]}) ``` ```javascript JavaScript -const page = await client.getAll({ - filters: { "AND": [{ user_id: "alice" }] }, - page: 1, - pageSize: 50, -}); +await client.getAll({ filters: {"AND": [{"user_id": "alice"}]} }); ``` - - The async client returns the same paginated envelope as the sync client: `{"count", "next", "previous", "results"}`. - - ### Delete Delete a specific memory asynchronously. diff --git a/docs/platform/features/direct-import.mdx b/docs/platform/features/direct-import.mdx index 4058766f7..b28348cf5 100644 --- a/docs/platform/features/direct-import.mdx +++ b/docs/platform/features/direct-import.mdx @@ -23,27 +23,11 @@ client.add(messages, user_id="alice", infer=False) ``` ```markdown Output -{ - "message": "Memories stored successfully", - "status": "SUCCEEDED", - "event_id": "evt_123", - "results": [ - { - "id": "19d6d7aa-2454-4e58-96fc-e74d9e9f8dd1", - "memory": "Alice loves playing badminton", - "event": "ADD" - }, - { - "id": "8557f05d-7b3c-47e5-b409-9886f9e314fc", - "memory": "Alice mostly cooks at home because of her gym plan", - "event": "ADD" - } - ] -} +[] ``` -In V3, `infer=False` stores the supplied memory text directly and returns a successful event envelope with the created memories in `results`. +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. @@ -95,9 +79,6 @@ client.get_all(filters={"AND": [{"user_id": "alice"}]}) ```json Output { - "count": 2, - "next": null, - "previous": null, "results": [ { "id": "19d6d7aa-2454-4e58-96fc-e74d9e9f8dd1",