docs: fix temporal reasoning doc accuracy
- Revert OSS search tip to user_id kwarg form (not filters dict) - Remove false "additional top-level fields" claim in migration guide; restore "response shape is unchanged" wording - Remove score_breakdown from JSON examples (not a real response field) - Remove cookbook-style "See it in action" section from temporal-reasoning.mdx Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
5559bf2dac
commit
96e521dad9
@@ -215,7 +215,7 @@ client.search("preferences", filters={
|
||||
- **Use natural language**: Mem0 understands intent, so describe what you're looking for naturally
|
||||
- **Scope with user ID**: Always provide `user_id` to scope search to relevant memories
|
||||
- **Platform API**: Use `filters={"user_id": "alice"}`
|
||||
- **OSS**: Use `filters={"user_id": "alice"}`
|
||||
- **OSS**: Use `user_id="alice"` as parameter
|
||||
- **Combine filters**: Use AND/OR logic to create precise queries (Platform)
|
||||
- **Consider wildcard filters**: Use wildcard filters (e.g., `run_id: "*"`) for broader matches
|
||||
- **Tune parameters**: Adjust `top_k` for result count, `threshold` for relevance cutoff
|
||||
|
||||
@@ -42,7 +42,7 @@ Previously, when an agent said something like "I've booked your flight for March
|
||||
|
||||
### Retrieval is hybrid now
|
||||
|
||||
Search now uses hybrid retrieval, which improves ranking quality — especially for queries involving exact keywords, proper nouns, entities that appear across multiple memories, and time-aware queries. Existing code that reads `results[]` and the top-level `score` continues to work, but V3 can return additional top-level fields when the platform has more structured context available:
|
||||
Search now uses hybrid retrieval, which improves ranking quality — especially for queries involving exact keywords, proper nouns, entities that appear across multiple memories, and time-aware queries (via Temporal Reasoning). The response shape is unchanged:
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -51,11 +51,6 @@ Search now uses hybrid retrieval, which improves ranking quality — especially
|
||||
"id": "mem-uuid",
|
||||
"memory": "User moved to San Francisco in January 2026",
|
||||
"score": 0.82,
|
||||
"score_breakdown": {
|
||||
"semantic": 0.74,
|
||||
"bm25": 0.68,
|
||||
"entity": 0.12
|
||||
},
|
||||
"metadata": {},
|
||||
"categories": ["location"]
|
||||
}
|
||||
@@ -63,7 +58,7 @@ Search now uses hybrid retrieval, which improves ranking quality — especially
|
||||
}
|
||||
```
|
||||
|
||||
The top-level `score` remains a `[0, 1]` value. Relative ranking between results stays comparable to v2, but absolute numbers shift since the scoring method changed — retune any hard thresholds in your app against representative queries. Temporal signals are used internally for ranking and are not returned as extra client-facing data.
|
||||
The top-level `score` remains a `[0, 1]` value. Relative ranking between results stays comparable to v2, but absolute numbers shift since the scoring method changed — retune any hard thresholds in your app against representative queries. Temporal signals are applied internally during ranking and are not returned as extra client-facing fields.
|
||||
|
||||
## API Changes
|
||||
|
||||
@@ -169,11 +164,6 @@ Poll status via `GET /v1/event/{event_id}/` — status will be `SUCCEEDED` or `F
|
||||
"id": "mem-uuid",
|
||||
"memory": "User moved to San Francisco from New York in January 2026",
|
||||
"score": 0.82,
|
||||
"score_breakdown": {
|
||||
"semantic": 0.74,
|
||||
"bm25": 0.68,
|
||||
"entity": 0.12
|
||||
},
|
||||
"metadata": {},
|
||||
"categories": ["location"],
|
||||
"created_at": "2026-01-15T10:30:00Z",
|
||||
|
||||
@@ -99,80 +99,6 @@ const results = await client.search("what did I do last week?", {
|
||||
`reference_date` is especially useful for tests and backfills because it makes relative phrases reproducible.
|
||||
</Tip>
|
||||
|
||||
## See it in action
|
||||
|
||||
### Add a few dated memories
|
||||
|
||||
<CodeGroup>
|
||||
```python Python
|
||||
client.add(
|
||||
[{"role": "user", "content": "I finished the Q1 product review on March 10, 2025."}],
|
||||
user_id="jordan",
|
||||
)
|
||||
|
||||
client.add(
|
||||
[{"role": "user", "content": "I have a dentist appointment on April 18, 2025 at 2 PM."}],
|
||||
user_id="jordan",
|
||||
)
|
||||
|
||||
client.add(
|
||||
[{"role": "user", "content": "I am the product lead at Acme Corp."}],
|
||||
user_id="jordan",
|
||||
)
|
||||
```
|
||||
|
||||
```javascript JavaScript
|
||||
await client.add(
|
||||
[{ role: "user", content: "I finished the Q1 product review on March 10, 2025." }],
|
||||
{ userId: "jordan" }
|
||||
);
|
||||
|
||||
await client.add(
|
||||
[{ role: "user", content: "I have a dentist appointment on April 18, 2025 at 2 PM." }],
|
||||
{ userId: "jordan" }
|
||||
);
|
||||
|
||||
await client.add(
|
||||
[{ role: "user", content: "I am the product lead at Acme Corp." }],
|
||||
{ userId: "jordan" }
|
||||
);
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
<Note>
|
||||
Platform writes are asynchronous. For quick validation, wait briefly before searching or verify the completed event in the dashboard or CLI.
|
||||
</Note>
|
||||
|
||||
### Search with a temporal query
|
||||
|
||||
<CodeGroup>
|
||||
```python Python
|
||||
results = client.search(
|
||||
"what did I do last week?",
|
||||
filters={"user_id": "jordan"},
|
||||
reference_date="2025-03-21T00:00:00Z",
|
||||
)
|
||||
|
||||
for item in results["results"]:
|
||||
print(item["memory"], item["score"])
|
||||
```
|
||||
|
||||
```javascript JavaScript
|
||||
const results = await client.search("what did I do last week?", {
|
||||
filters: { user_id: "jordan" },
|
||||
referenceDate: "2025-03-21T00:00:00Z",
|
||||
});
|
||||
|
||||
results.results.forEach((item) => {
|
||||
console.log(item.memory, item.score);
|
||||
});
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
<Info icon="check">
|
||||
Expected behavior: the March 10 review leads this result set, the April 18 appointment does not, and the ongoing role at Acme does not crowd out the dated answer.
|
||||
</Info>
|
||||
|
||||
## Supported query patterns
|
||||
|
||||
<AccordionGroup>
|
||||
|
||||
Reference in New Issue
Block a user