[docs] platform core concept revamp and overview update (#3664)
This commit is contained in:
@@ -5,20 +5,23 @@ icon: "magnifying-glass"
|
||||
iconType: "solid"
|
||||
---
|
||||
|
||||
## Overview
|
||||
# How Mem0 Searches Memory
|
||||
|
||||
The `search` operation allows you to retrieve relevant memories based on a natural language query and optional filters like user ID, agent ID, categories, and more. This is the foundation of giving your agents memory-aware behavior.
|
||||
Mem0’s search operation lets agents ask natural-language questions and get back the memories that matter most. It’s the bridge between everything you’ve stored and the next response your agent writes.
|
||||
|
||||
Mem0 supports:
|
||||
- Semantic similarity search
|
||||
- Metadata filtering (with advanced logic)
|
||||
- Reranking and thresholds
|
||||
- Cross-agent, multi-session context resolution
|
||||
<Info>
|
||||
**Why it matters**
|
||||
- Retrieves the right facts without rebuilding prompts from scratch.
|
||||
- Supports both managed Platform and OSS so you can test locally and deploy at scale.
|
||||
- Keeps results relevant with filters, rerankers, and thresholds.
|
||||
</Info>
|
||||
|
||||
This applies to both:
|
||||
- **Mem0 Platform** (hosted API with full-scale features)
|
||||
- **Mem0 Open Source** (local-first with LLM inference and local vector DB)
|
||||
## Key terms
|
||||
|
||||
- **Query** – Natural-language question or statement you pass to `search`.
|
||||
- **Filters** – JSON logic (AND/OR, comparison operators) that narrows results by user, categories, dates, etc.
|
||||
- **top_k / threshold** – Controls how many memories return and the minimum similarity score.
|
||||
- **Rerank** – Optional second pass that boosts precision when a reranker is configured.
|
||||
|
||||
## Architecture
|
||||
|
||||
@@ -26,23 +29,26 @@ This applies to both:
|
||||
<img src="../../images/search_architecture.png" />
|
||||
</Frame>
|
||||
|
||||
When you call `search`, Mem0 performs the following steps:
|
||||
<Steps>
|
||||
<Step title="Query processing">
|
||||
Mem0 cleans and enriches your natural-language query so the downstream embedding search is accurate.
|
||||
</Step>
|
||||
<Step title="Vector search">
|
||||
Embeddings locate the closest memories using cosine similarity across your scoped dataset.
|
||||
</Step>
|
||||
<Step title="Filtering & reranking">
|
||||
Logical filters narrow candidates; rerankers or thresholds fine-tune ordering.
|
||||
</Step>
|
||||
<Step title="Results delivery">
|
||||
Formatted memories (with metadata and timestamps) return to your agent or calling service.
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
1. **Query Processing**
|
||||
An LLM refines and optimizes your natural language query.
|
||||
|
||||
2. **Vector Search**
|
||||
Semantic embeddings are used to find the most relevant memories using cosine similarity.
|
||||
|
||||
3. **Filtering & Ranking**
|
||||
Logical and comparison-based filters are applied. Memories are scored, filtered, and optionally reranked.
|
||||
|
||||
4. **Results Delivery**
|
||||
Relevant memories are returned with associated metadata and timestamps.
|
||||
This pipeline runs the same way for the hosted Platform API and the OSS SDK.
|
||||
|
||||
---
|
||||
|
||||
## Example: Mem0 Platform
|
||||
## Search with Mem0 Platform
|
||||
|
||||
<CodeGroup>
|
||||
```python Python
|
||||
@@ -81,7 +87,7 @@ const results = await client.search(query, {
|
||||
|
||||
---
|
||||
|
||||
## Example: Mem0 Open Source
|
||||
## Search with Mem0 Open Source
|
||||
|
||||
<CodeGroup>
|
||||
```python Python
|
||||
@@ -118,7 +124,11 @@ const memories = memory.search("food preferences", {
|
||||
|
||||
---
|
||||
|
||||
## Using Filters
|
||||
<Info icon="check">
|
||||
Expect an array of memory documents. Platform responses include vectors, metadata, and timestamps; OSS returns your stored schema.
|
||||
</Info>
|
||||
|
||||
## Filter patterns
|
||||
|
||||
Filters help narrow down search results. Common use cases:
|
||||
|
||||
@@ -152,7 +162,7 @@ client.search("preferences", filters={
|
||||
|
||||
---
|
||||
|
||||
## Tips for Better Search
|
||||
## Tips for better search
|
||||
|
||||
- **Use natural language**: Mem0 understands intent, so describe what you're looking for naturally
|
||||
- **Scope with session IDs**: Always provide at least `user_id` to scope search to relevant memories
|
||||
@@ -167,7 +177,38 @@ client.search("preferences", filters={
|
||||
For the full list of filter logic, comparison operators, and optional search parameters, see the
|
||||
[Search Memory API Reference](/api-reference/memory/search-memories).
|
||||
|
||||
## Need help?
|
||||
If you have any questions, please feel free to reach out to us using one of the following methods:
|
||||
## Managed vs OSS differences
|
||||
|
||||
<Snippet file="get-help.mdx"/>
|
||||
| Capability | Mem0 Platform | Mem0 OSS |
|
||||
| --- | --- | --- |
|
||||
| Filters | Logical operators (`AND`, `OR`, comparisons) with field-level access | Basic field filters, extend via Python hooks |
|
||||
| Reranking | Toggle `rerank=True` with managed reranker catalog | Requires configuring local or third-party rerankers |
|
||||
| Thresholds | Request-level configuration (`threshold`, `top_k`) | Controlled via SDK parameters |
|
||||
| Response metadata | Includes confidence scores, timestamps, dashboard visibility | Determined by your storage backend |
|
||||
|
||||
## Put it into practice
|
||||
|
||||
- Revisit the <Link href="/core-concepts/memory-operations/add">Add Memory</Link> guide to ensure you capture the context you expect to retrieve.
|
||||
- Configure rerankers and filters in <Link href="/platform/features/advanced-retrieval">Advanced Retrieval</Link> for higher precision.
|
||||
|
||||
## See it live
|
||||
|
||||
- <Link href="/examples/customer-support-agent">Customer Support Agent</Link> demonstrates scoped search with rerankers.
|
||||
- <Link href="/examples/personalized-search-tavily-mem0">Personalized Search with Tavily</Link> shows hybrid search in action.
|
||||
|
||||
{/* DEBUG: verify CTA targets */}
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card
|
||||
title="Tune Update Concepts"
|
||||
description="Learn how to adjust memories after search results come back."
|
||||
icon="pencil"
|
||||
href="/core-concepts/memory-operations/update"
|
||||
/>
|
||||
<Card
|
||||
title="Build Hybrid Search"
|
||||
description="Follow the cookbook to combine Mem0 with external search."
|
||||
icon="rocket"
|
||||
href="/examples/personalized-search-tavily-mem0"
|
||||
/>
|
||||
</CardGroup>
|
||||
|
||||
Reference in New Issue
Block a user