Skip to content

Commit 3b84a23

Browse files
Updates to python sdk (#3749)
1 parent 2bca30e commit 3b84a23

File tree

4 files changed

+10
-60
lines changed

4 files changed

+10
-60
lines changed

docs/migration/breaking-changes.mdx

Lines changed: 7 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ config = {
2424

2525
result = m.add(
2626
"memory content",
27-
user_id="alice",
28-
output_format="v1.0" # ❌ No longer supported
27+
user_id="alice"
2928
)
3029
```
3130

@@ -39,7 +38,6 @@ config = {
3938
result = m.add(
4039
"memory content",
4140
user_id="alice"
42-
# output_format parameter removed
4341
)
4442
```
4543

@@ -51,28 +49,7 @@ Please use v1.1 format which returns a dict with 'results' key.
5149

5250
## Parameter Removals
5351

54-
### 1. output_format Parameter
55-
56-
**Removed from all methods:**
57-
- `add()`
58-
- `search()`
59-
- `get_all()`
60-
61-
#### Before (v0.x)
62-
```python
63-
result = m.add("content", user_id="alice", output_format="v1.1")
64-
search_results = m.search("query", user_id="alice", output_format="v1.1")
65-
all_memories = m.get_all(user_id="alice", output_format="v1.1")
66-
```
67-
68-
#### After (v1.0.0 )
69-
```python
70-
result = m.add("content", user_id="alice")
71-
search_results = m.search("query", user_id="alice")
72-
all_memories = m.get_all(user_id="alice")
73-
```
74-
75-
### 2. version Parameter in Method Calls
52+
### 1. version Parameter in Method Calls
7653

7754
**Breaking Change:** Version parameter removed from method calls.
7855

@@ -86,7 +63,7 @@ result = m.add("content", user_id="alice", version="v1.0")
8663
result = m.add("content", user_id="alice")
8764
```
8865

89-
### 3. async_mode Parameter (Platform Client)
66+
### 2. async_mode Parameter (Platform Client)
9067

9168
**Change:** For `MemoryClient` (Platform API), `async_mode` now defaults to `True` but can still be configured.
9269

@@ -120,12 +97,10 @@ result = client.add("content", user_id="alice", async_mode=False)
12097

12198
#### Before (v0.x)
12299
```python
123-
# Could return different formats based on output_format parameter
124-
result = m.add("content", user_id="alice", output_format="v1.0")
125-
# Returns: [{"id": "...", "memory": "...", "event": "ADD"}]
126-
127-
result = m.add("content", user_id="alice", output_format="v1.1")
128-
# Returns: {"results": [{"id": "...", "memory": "...", "event": "ADD"}]}
100+
# Could return different formats based on version configuration
101+
result = m.add("content", user_id="alice")
102+
# With v1.0: Returns [{"id": "...", "memory": "...", "event": "ADD"}]
103+
# With v1.1: Returns {"results": [{"id": "...", "memory": "...", "event": "ADD"}]}
129104
```
130105

131106
#### After (v1.0.0 )

docs/migration/v0-to-v1.mdx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ Mem0 1.0.0 is a major release that modernizes the API, improves performance, an
1919
|---------|------|-------------|-------------------|
2020
| API Version | v1.0 supported | v1.0 **removed**, v1.1+ only | ✅ Yes |
2121
| Async Mode (Platform Client) | Optional/manual | Defaults to `True`, configurable | ⚠️ Partial |
22-
| Output Format Parameter | Supported | **Removed** | ✅ Yes |
23-
| Response Format | Mixed | Standardized `{"results": [...]}` | ✅ Yes |
2422
| Metadata Filtering | Basic | Enhanced with operators | ⚠️ Optional |
2523
| Reranking | Not available | Full support | ⚠️ Optional |
2624

@@ -44,7 +42,6 @@ m = Memory()
4442
result = m.add(
4543
"I love pizza",
4644
user_id="alice",
47-
output_format="v1.0", # ❌ REMOVED
4845
version="v1.0" # ❌ REMOVED
4946
)
5047
```
@@ -58,7 +55,7 @@ m = Memory()
5855
result = m.add(
5956
"I love pizza",
6057
user_id="alice"
61-
# output_format and version parameters removed
58+
# version parameter removed
6259
)
6360
```
6461

@@ -407,7 +404,7 @@ TypeError: add() got an unexpected keyword argument 'output_format'
407404
result = m.add(
408405
"memory",
409406
user_id="alice"
410-
# Remove: output_format, version
407+
# Remove: version
411408
)
412409
```
413410

mem0/client/main.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -161,15 +161,6 @@ def add(self, messages, **kwargs) -> Dict[str, Any]:
161161

162162
kwargs = self._prepare_params(kwargs)
163163

164-
# Remove deprecated parameters
165-
if "output_format" in kwargs:
166-
warnings.warn(
167-
"output_format parameter is deprecated and ignored. All responses now use v1.1 format.",
168-
DeprecationWarning,
169-
stacklevel=2,
170-
)
171-
kwargs.pop("output_format")
172-
173164
# Set async_mode to True by default, but allow user override
174165
if "async_mode" not in kwargs:
175166
kwargs["async_mode"] = True
@@ -228,7 +219,6 @@ def get_all(self, **kwargs) -> Dict[str, Any]:
228219
MemoryNotFoundError: If the memory doesn't exist (for updates/deletes).
229220
"""
230221
params = self._prepare_params(kwargs)
231-
params.pop("output_format", None) # Remove output_format for get operations
232222
params.pop("async_mode", None)
233223

234224
if "page" in params and "page_size" in params:
@@ -280,7 +270,6 @@ def search(self, query: str, **kwargs) -> Dict[str, Any]:
280270
"""
281271
payload = {"query": query}
282272
params = self._prepare_params(kwargs)
283-
params.pop("output_format", None) # Remove output_format for search operations
284273
params.pop("async_mode", None)
285274

286275
payload.update(params)
@@ -1103,15 +1092,6 @@ async def add(self, messages, **kwargs) -> Dict[str, Any]:
11031092

11041093
kwargs = self._prepare_params(kwargs)
11051094

1106-
# Remove deprecated parameters
1107-
if "output_format" in kwargs:
1108-
warnings.warn(
1109-
"output_format parameter is deprecated and ignored. All responses now use v1.1 format.",
1110-
DeprecationWarning,
1111-
stacklevel=2,
1112-
)
1113-
kwargs.pop("output_format")
1114-
11151095
# Set async_mode to True by default, but allow user override
11161096
if "async_mode" not in kwargs:
11171097
kwargs["async_mode"] = True
@@ -1137,7 +1117,6 @@ async def get(self, memory_id: str) -> Dict[str, Any]:
11371117
@api_error_handler
11381118
async def get_all(self, **kwargs) -> Dict[str, Any]:
11391119
params = self._prepare_params(kwargs)
1140-
params.pop("output_format", None) # Remove output_format for get operations
11411120
params.pop("async_mode", None)
11421121

11431122
if "page" in params and "page_size" in params:
@@ -1171,7 +1150,6 @@ async def get_all(self, **kwargs) -> Dict[str, Any]:
11711150
async def search(self, query: str, **kwargs) -> Dict[str, Any]:
11721151
payload = {"query": query}
11731152
params = self._prepare_params(kwargs)
1174-
params.pop("output_format", None) # Remove output_format for search operations
11751153
params.pop("async_mode", None)
11761154

11771155
payload.update(params)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "mem0ai"
7-
version = "1.0.0"
7+
version = "1.0.1"
88
description = "Long-term memory for AI Agents"
99
authors = [
1010
{ name = "Mem0", email = "[email protected]" }

0 commit comments

Comments
 (0)