fix: cleanup docs with stale contents
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -72,13 +72,13 @@ client = MemoryClient(api_key="m0-...")
|
||||
```
|
||||
|
||||
<Info icon="check">
|
||||
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.
|
||||
</Info>
|
||||
|
||||
### 3. Update Retrieval Calls (Critical)
|
||||
|
||||
<Warning>
|
||||
**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.
|
||||
</Warning>
|
||||
|
||||
<Note>
|
||||
@@ -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.
|
||||
|
||||
<Note>
|
||||
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.
|
||||
</Note>
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="Search Memories">
|
||||
<CodeGroup>
|
||||
@@ -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)
|
||||
```
|
||||
</CodeGroup>
|
||||
</Accordion>
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
<Callout type="warning" title="Filters Required">
|
||||
`get_all()` now requires filters to be specified.
|
||||
@@ -82,27 +82,15 @@ Retrieve a paginated list of memories for a user asynchronously.
|
||||
<CodeGroup>
|
||||
|
||||
```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"}]} });
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
<Note>
|
||||
The async client returns the same paginated envelope as the sync client: `{"count", "next", "previous", "results"}`.
|
||||
</Note>
|
||||
|
||||
### Delete
|
||||
|
||||
Delete a specific memory asynchronously.
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
[]
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
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.
|
||||
|
||||
<Note>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.</Note>
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user