The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.
Python agentic-memoryagentic-memory-systemagentsaiai-agentschatgptgenaillmlong-term-memorymemorymemory-managementpythonragstate-management
[docs] API References and search Doc fix (#3712)
Parth Sharma76abd5117d3a
diff --git a/docs/api-reference/memory/get-memories.mdx b/docs/api-reference/memory/get-memories.mdxindex f2003e3bd..21fe6227e 100644--- a/docs/api-reference/memory/get-memories.mdx+++ b/docs/api-reference/memory/get-memories.mdx@@ -16,7 +16,7 @@ The v2 get memories API is powerful and flexible, allowing for more precise memo<CodeGroup>```python Code-memories = m.get_all(+memories = client.get_all(filters={"AND": [{@@ -58,7 +58,7 @@ To retrieve graph memory relationships between entities, pass `output_format="v1<CodeGroup>```python Code-memories = m.get_all(+memories = client.get_all(filters={"user_id": "alex"},diff --git a/docs/api-reference/memory/search-memories.mdx b/docs/api-reference/memory/search-memories.mdxindex fdb33224d..6e58c09f3 100644--- a/docs/api-reference/memory/search-memories.mdx+++ b/docs/api-reference/memory/search-memories.mdx@@ -14,8 +14,8 @@ The v2 search API is powerful and flexible, allowing for more precise memory ret- `*`: Wildcard character that matches everything<CodeGroup>-```python Code-related_memories = m.search(+```python Platform API Example+related_memories = client.search(query="What are Alice's hobbies?",filters={"OR": [@@ -53,7 +53,7 @@ related_memories = m.search(<CodeGroup>```python Wildcard Example# Using wildcard to match all run_ids for a specific user-all_memories = m.search(+all_memories = client.search(query="What are Alice's hobbies?",filters={"AND": [@@ -72,7 +72,7 @@ all_memories = m.search(<CodeGroup>```python Categories Filter Examples# Example 1: Using 'contains' for partial matching-finance_memories = m.search(+finance_memories = client.search(query="What are my financial goals?",filters={"AND": [@@ -87,7 +87,7 @@ finance_memories = m.search()# Example 2: Using 'in' for exact matching-personal_memories = m.search(+personal_memories = client.search(query="What personal information do you have?",filters={"AND": [diff --git a/docs/core-concepts/memory-operations/search.mdx b/docs/core-concepts/memory-operations/search.mdxindex 16a74dee3..0d7f0cf4c 100644--- a/docs/core-concepts/memory-operations/search.mdx+++ b/docs/core-concepts/memory-operations/search.mdx@@ -7,7 +7,7 @@ iconType: "solid"# How Mem0 Searches Memory-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's search operation lets agents ask natural-language questions and get back the memories that matter most. Like a smart librarian, it finds exactly what you need from everything you've stored.<Info>**Why it matters**@@ -46,7 +46,39 @@ Formatted memories (with metadata and timestamps) return to your agent or callinThis pipeline runs the same way for the hosted Platform API and the OSS SDK.----+## How does it work?++Search converts your natural language question into a vector embedding, then finds memories with similar embeddings in your database. The results are ranked by similarity score and can be further refined with filters or reranking.++```python+# Minimal example that shows the concept in action+# Platform API+client.search("What are Alice's hobbies?", filters={"user_id": "alice"})++# OSS+m.search("What are Alice's hobbies?", user_id="alice")+```++<Tip>+ Always provide at least a `user_id` filter to scope searches to the right user's memories. This prevents cross-contamination between users.+</Tip>++## When should you use it?++- **Context retrieval** - When your agent needs past context to generate better responses+- **Personalization** - To recall user preferences, history, or past interactions+- **Fact checking** - To verify information against stored memories before responding+- **Decision support** - When agents need relevant background information to make decisions++## Platform vs OSS usage++| Capability | Mem0 Platform | Mem0 OSS |+| --- | --- | --- |+| **user_id usage** | In `filters={"user_id": "alice"}` for search/get_all | As parameter `user_id="alice"` for all operations |+| **Filter syntax** | 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 |## Search with Mem0 Platform@@ -85,8 +117,6 @@ const results = await client.search(query, {```</CodeGroup>-----## Search with Mem0 Open Source<CodeGroup>@@ -122,8 +152,6 @@ const memories = memory.search("food preferences", {```</CodeGroup>-----<Info icon="check">Expect an array of memory documents. Platform responses include vectors, metadata, and timestamps; OSS returns your stored schema.</Info>@@ -133,6 +161,20 @@ const memories = memory.search("food preferences", {Filters help narrow down search results. Common use cases:**Filter by Session Context:**++*Platform API:*+```python+# Get memories from a specific agent session+client.search("query", filters={+ "AND": [+ {"user_id": "alice"},+ {"agent_id": "chatbot"},+ {"run_id": "session-123"}+ ]+})+```++*OSS:*```python# Get memories from a specific agent sessionm.search("query", user_id="alice", agent_id="chatbot", run_id="session-123")@@ -160,32 +202,22 @@ client.search("preferences", filters={})```-----## 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+- **Scope with user ID**: Always provide `user_id` to scope search to relevant memories+ - **Platform API**: 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- **Enable reranking**: Use `rerank=True` (default) when you have a reranker configured-### More DetailsFor the full list of filter logic, comparison operators, and optional search parameters, see the[Search Memory API Reference](/api-reference/memory/search-memories).-## Managed vs OSS differences--| 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.@@ -200,15 +232,15 @@ For the full list of filter logic, comparison operators, and optional search par<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"+ title="Search Memory API"+ description="Complete API reference with all filter operators and parameters."+ icon="book"+ href="/api-reference/memory/search-memories"/><Card- title="Build Hybrid Search"- description="Follow the cookbook to combine Mem0 with external search."+ title="Support Inbox Cookbook"+ description="Build a complete support system with scoped search and reranking."icon="rocket"- href="/cookbooks/integrations/tavily-search"+ href="/cookbooks/operations/support-inbox"/>-</CardGroup>+</CardGroup>\ No newline at end of filediff --git a/docs/docs.json b/docs/docs.jsonindex 6e3064914..bfdc428ab 100644--- a/docs/docs.json+++ b/docs/docs.json@@ -677,7 +677,6 @@"group": "\ud83d\udca1 Examples","icon": "lightbulb","pages": [- "examples","v0x/examples/mem0-demo","v0x/examples/ai_companion_js","v0x/examples/mem0-with-ollama",