docs(migration): correct migration guides to match v3 (update available, no async_mode/graph_store/offset)
This commit is contained in:
@@ -1147,6 +1147,10 @@
|
||||
{
|
||||
"source": "/openmemory/integrations",
|
||||
"destination": "/introduction"
|
||||
},
|
||||
{
|
||||
"source": "/migration/api-changes",
|
||||
"destination": "/migration/platform-v2-to-v3"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -71,12 +71,14 @@ def add(
|
||||
def add(
|
||||
self,
|
||||
messages,
|
||||
*,
|
||||
user_id: str = None,
|
||||
agent_id: str = None,
|
||||
run_id: str = None,
|
||||
metadata: dict = None,
|
||||
filters: dict = None,
|
||||
infer: bool = True # ✅ NEW: Control memory inference
|
||||
infer: bool = True, # ✅ NEW: Control memory inference
|
||||
memory_type: str = None, # ✅ NEW: e.g. "procedural_memory"
|
||||
prompt: str = None # ✅ NEW: Custom extraction prompt
|
||||
) -> dict: # Always returns dict with "results" key
|
||||
...
|
||||
```
|
||||
@@ -90,10 +92,12 @@ def add(
|
||||
| `agent_id` | ✅ | ✅ | Unchanged |
|
||||
| `run_id` | ✅ | ✅ | Unchanged |
|
||||
| `metadata` | ✅ | ✅ | Unchanged |
|
||||
| `filters` | ✅ | ✅ | Unchanged |
|
||||
| `filters` | ✅ | ❌ | **REMOVED** — `add()` does not accept `filters` |
|
||||
| `output_format` | ✅ | ❌ | **REMOVED** |
|
||||
| `version` | ✅ | ❌ | **REMOVED** |
|
||||
| `infer` | ❌ | ✅ | **NEW** |
|
||||
| `memory_type` | ❌ | ✅ | **NEW** |
|
||||
| `prompt` | ❌ | ✅ | **NEW** |
|
||||
|
||||
#### Response Format Changes
|
||||
|
||||
@@ -158,16 +162,19 @@ def search(
|
||||
def search(
|
||||
self,
|
||||
query: str,
|
||||
user_id: str = None,
|
||||
agent_id: str = None,
|
||||
run_id: str = None,
|
||||
limit: int = 100,
|
||||
filters: dict = None, # ✅ ENHANCED: Advanced operators
|
||||
rerank: bool = True # ✅ NEW: Reranking support
|
||||
*,
|
||||
top_k: int = 20, # ✅ Renamed from limit
|
||||
filters: dict = None, # ✅ ENHANCED: Advanced operators; must include user_id/agent_id/run_id
|
||||
threshold: float = 0.1, # ✅ NEW: Minimum score cutoff
|
||||
rerank: bool = False # ✅ NEW: Reranking support (default False)
|
||||
) -> dict: # Always returns dict with "results" key
|
||||
...
|
||||
```
|
||||
|
||||
<Warning>
|
||||
`user_id`, `agent_id`, and `run_id` are **not** top-level parameters in v1. They must be passed inside `filters`. Example: `m.search("query", filters={"user_id": "alice"})`.
|
||||
</Warning>
|
||||
|
||||
#### Enhanced Filtering
|
||||
|
||||
**v0.x Filters (basic):**
|
||||
@@ -289,30 +296,11 @@ m.delete_all(user_id="*", agent_id="*", app_id="*", run_id="*") # NEW — fu
|
||||
|
||||
## Platform Client (MemoryClient) Changes
|
||||
|
||||
### async_mode Default Changed
|
||||
### async_mode Removed
|
||||
|
||||
#### v0.x
|
||||
```python
|
||||
from mem0 import MemoryClient
|
||||
|
||||
client = MemoryClient(api_key="your-key")
|
||||
|
||||
# async_mode had to be explicitly set or had different default
|
||||
result = client.add("content", user_id="alice", async_mode=True)
|
||||
```
|
||||
|
||||
#### v1.0.0
|
||||
```python
|
||||
from mem0 import MemoryClient
|
||||
|
||||
client = MemoryClient(api_key="your-key")
|
||||
|
||||
# async_mode defaults to True now (better performance)
|
||||
result = client.add("content", user_id="alice") # Uses async_mode=True by default
|
||||
|
||||
# Can still override if needed
|
||||
result = client.add("content", user_id="alice", async_mode=False)
|
||||
```
|
||||
<Note>
|
||||
`async_mode` was removed in v3. Remove any `async_mode=` argument from your `MemoryClient` calls.
|
||||
</Note>
|
||||
|
||||
## Configuration Changes
|
||||
|
||||
@@ -324,7 +312,6 @@ config = {
|
||||
"vector_store": {...},
|
||||
"llm": {...},
|
||||
"embedder": {...},
|
||||
"graph_store": {...},
|
||||
"version": "v1.0", # ❌ v1.0 no longer supported
|
||||
"history_db_path": "...",
|
||||
"custom_instructions": "..."
|
||||
@@ -337,18 +324,21 @@ config = {
|
||||
"vector_store": {...},
|
||||
"llm": {...},
|
||||
"embedder": {...},
|
||||
"graph_store": {...},
|
||||
"reranker": { # ✅ NEW: Reranker support
|
||||
"provider": "cohere",
|
||||
"config": {...}
|
||||
},
|
||||
"version": "v1.1", # ✅ v1.1+ only
|
||||
"history_db_path": "...",
|
||||
"custom_instructions": "...",
|
||||
"custom_update_memory_prompt": "..." # ✅ NEW: Custom update prompt
|
||||
"custom_instructions": "..." # ✅ Use this for custom extraction instructions
|
||||
}
|
||||
```
|
||||
|
||||
<Note>
|
||||
`graph_store` is no longer a top-level `MemoryConfig` field. Graph support is configured separately.
|
||||
`custom_update_memory_prompt` has been removed — use `custom_instructions` instead.
|
||||
</Note>
|
||||
|
||||
### New Configuration Options
|
||||
|
||||
#### Reranker Configuration
|
||||
|
||||
@@ -120,13 +120,14 @@ client = MemoryClient(api_key="m0-...")
|
||||
|
||||
| Method | Open Source | Platform |
|
||||
| ------ | ----------- | -------- |
|
||||
| `search()` | `m.search(query, user_id="alex")` | `client.search(query, filters={"user_id": "alex"})` |
|
||||
| `get_all()` | `m.get_all(user_id="alex")` | `client.get_all(filters={"user_id": "alex"})` |
|
||||
| `search()` | `m.search(query, filters={"user_id": "alex"})` | `client.search(query, filters={"user_id": "alex"})` |
|
||||
| `get_all()` | `m.get_all(filters={"user_id": "alex"})` | `client.get_all(filters={"user_id": "alex"})` |
|
||||
| `add()` | `m.add(memory, user_id="alex")` | `client.add(memory, user_id="alex")` |
|
||||
| `update()` | `m.update(memory_id, data="Updated content")` | `client.update(memory_id, text="Updated content")` |
|
||||
| `delete()` | `m.delete(memory_id)` | `client.delete(memory_id)` |
|
||||
| `delete_all()` | `m.delete_all(user_id="alex")` | `client.delete_all(user_id="alex")` |
|
||||
|
||||
Note: `add()` and `delete()` methods remain unchanged. The `update()` method is not available in Platform - use delete + add pattern instead.
|
||||
Note: `add()` and `delete()` methods remain unchanged. The `update()` method is available in Platform via `client.update(memory_id, text="Updated content")`.
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="Search Memories">
|
||||
@@ -158,18 +159,15 @@ Note: `add()` and `delete()` methods remain unchanged. The `update()` method is
|
||||
<CodeGroup>
|
||||
```python Open Source (Old)
|
||||
# Get all memories for a user
|
||||
memories = m.get_all(user_id="alex", top_k=10)
|
||||
|
||||
# Get memories with pagination
|
||||
memories = m.get_all(user_id="alex", top_k=5, offset=10)
|
||||
memories = m.get_all(filters={"user_id": "alex"}, top_k=10)
|
||||
```
|
||||
|
||||
```python Platform (New)
|
||||
# Get all memories for a user
|
||||
memories = client.get_all(filters={"user_id": "alex"}, top_k=10)
|
||||
|
||||
# Get memories with pagination
|
||||
memories = client.get_all(filters={"user_id": "alex"}, top_k=5, offset=10)
|
||||
# Get memories with pagination (Platform supports page/page_size)
|
||||
memories = client.get_all(filters={"user_id": "alex"}, page=2, page_size=10)
|
||||
```
|
||||
</CodeGroup>
|
||||
</Accordion>
|
||||
@@ -218,14 +216,12 @@ Note: `add()` and `delete()` methods remain unchanged. The `update()` method is
|
||||
<CodeGroup>
|
||||
```python Open Source (Old)
|
||||
# Update memory content
|
||||
m.update(memory_id="mem_123", new_memory="Updated content")
|
||||
m.update(memory_id="mem_123", data="Updated content")
|
||||
```
|
||||
|
||||
```python Platform (New)
|
||||
# Update memory (not available in Platform)
|
||||
# Use delete + add pattern instead
|
||||
client.delete(memory_id="mem_123")
|
||||
client.add("Updated content", user_id="alex")
|
||||
# Update memory content
|
||||
client.update(memory_id="mem_123", text="Updated content")
|
||||
```
|
||||
</CodeGroup>
|
||||
</Accordion>
|
||||
@@ -392,7 +388,7 @@ The Platform introduces powerful capabilities not available in OSS:
|
||||
| **Add Method** | `m.add(memory, user_id="x")` | `client.add(memory, user_id="x")` | No change |
|
||||
| **Delete Method** | `m.delete(memory_id)` | `client.delete(memory_id)` | No change |
|
||||
| **Delete All** | `m.delete_all(user_id="x")` | `client.delete_all(user_id="x")` | No change |
|
||||
| **Update Method** | `m.update(memory_id, new_memory)` | Use delete + add pattern | Replace with delete then add |
|
||||
| **Update Method** | `m.update(memory_id, data="Updated content")` | `client.update(memory_id, text="Updated content")` | Rename `data=` kwarg to `text=` |
|
||||
| **Config** | Local vector store + LLM config | Managed cloud infrastructure | Remove local config setup |
|
||||
|
||||
## Rollback plan
|
||||
|
||||
Reference in New Issue
Block a user