Skip to content

Commit 394203d

Browse files
Mem0 1.0.0 (#3545)
1 parent 8f5151c commit 394203d

File tree

77 files changed

+3400
-945
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+3400
-945
lines changed

MIGRATION_GUIDE_v1.0.md

Lines changed: 221 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,221 @@
1+
# Migration Guide: Upgrading to mem0 1.0.0
2+
3+
## TL;DR
4+
5+
**What changed?** We simplified the API by removing confusing version parameters. Now everything returns a consistent format: `{"results": [...]}`.
6+
7+
**What you need to do:**
8+
1. Upgrade: `pip install mem0ai==1.0.0`
9+
2. Remove `version` and `output_format` parameters from your code
10+
3. Update response handling to use `result["results"]` instead of treating responses as lists
11+
12+
**Time needed:** ~5-10 minutes for most projects
13+
14+
---
15+
16+
## Quick Migration Guide
17+
18+
### 1. Install the Update
19+
20+
```bash
21+
pip install mem0ai==1.0.0
22+
```
23+
24+
### 2. Update Your Code
25+
26+
**If you're using the Memory API:**
27+
28+
```python
29+
# Before
30+
memory = Memory(config=MemoryConfig(version="v1.1"))
31+
result = memory.add("I like pizza")
32+
33+
# After
34+
memory = Memory() # That's it - version is automatic now
35+
result = memory.add("I like pizza")
36+
```
37+
38+
**If you're using the Client API:**
39+
40+
```python
41+
# Before
42+
client.add(messages, output_format="v1.1")
43+
client.search(query, version="v2", output_format="v1.1")
44+
45+
# After
46+
client.add(messages) # Just remove those extra parameters
47+
client.search(query)
48+
```
49+
50+
### 3. Update How You Handle Responses
51+
52+
All responses now use the same format: a dictionary with `"results"` key.
53+
54+
```python
55+
# Before - you might have done this
56+
result = memory.add("I like pizza")
57+
for item in result: # Treating it as a list
58+
print(item)
59+
60+
# After - do this instead
61+
result = memory.add("I like pizza")
62+
for item in result["results"]: # Access the results key
63+
print(item)
64+
65+
# Graph relations (if you use them)
66+
if "relations" in result:
67+
for relation in result["relations"]:
68+
print(relation)
69+
```
70+
71+
---
72+
73+
## Enhanced Message Handling
74+
75+
The platform client (MemoryClient) now supports the same flexible message formats as the OSS version:
76+
77+
```python
78+
from mem0 import MemoryClient
79+
80+
client = MemoryClient(api_key="your-key")
81+
82+
# All three formats now work:
83+
84+
# 1. Single string (automatically converted to user message)
85+
client.add("I like pizza", user_id="alice")
86+
87+
# 2. Single message dictionary
88+
client.add({"role": "user", "content": "I like pizza"}, user_id="alice")
89+
90+
# 3. List of messages (conversation)
91+
client.add([
92+
{"role": "user", "content": "I like pizza"},
93+
{"role": "assistant", "content": "I'll remember that!"}
94+
], user_id="alice")
95+
```
96+
97+
### Async Mode Configuration
98+
99+
The `async_mode` parameter now defaults to `True` but can be configured:
100+
101+
```python
102+
# Default behavior (async_mode=True)
103+
client.add(messages, user_id="alice")
104+
105+
# Explicitly set async mode
106+
client.add(messages, user_id="alice", async_mode=True)
107+
108+
# Disable async mode if needed
109+
client.add(messages, user_id="alice", async_mode=False)
110+
```
111+
112+
**Note:** `async_mode=True` provides better performance for most use cases. Only set it to `False` if you have specific synchronous processing requirements.
113+
114+
---
115+
116+
## That's It!
117+
118+
For most users, that's all you need to know. The changes are:
119+
- ✅ No more `version` or `output_format` parameters
120+
- ✅ Consistent `{"results": [...]}` response format
121+
- ✅ Cleaner, simpler API
122+
123+
---
124+
125+
## Common Issues
126+
127+
**Getting `KeyError: 'results'`?**
128+
129+
Your code is still treating the response as a list. Update it:
130+
```python
131+
# Change this:
132+
for memory in response:
133+
134+
# To this:
135+
for memory in response["results"]:
136+
```
137+
138+
**Getting `TypeError: unexpected keyword argument`?**
139+
140+
You're still passing old parameters. Remove them:
141+
```python
142+
# Change this:
143+
client.add(messages, output_format="v1.1")
144+
145+
# To this:
146+
client.add(messages)
147+
```
148+
149+
**Seeing deprecation warnings?**
150+
151+
Remove any explicit `version="v1.0"` from your config:
152+
```python
153+
# Change this:
154+
memory = Memory(config=MemoryConfig(version="v1.0"))
155+
156+
# To this:
157+
memory = Memory()
158+
```
159+
160+
---
161+
162+
## What's New in 1.0.0
163+
164+
- **Better vector stores:** Fixed OpenSearch and improved reliability across all stores
165+
- **Cleaner API:** One way to do things, no more confusing options
166+
- **Enhanced GCP support:** Better Vertex AI configuration options
167+
- **Flexible message input:** Platform client now accepts strings, dicts, and lists (aligned with OSS)
168+
- **Configurable async_mode:** Now defaults to `True` but users can override if needed
169+
170+
---
171+
172+
## Need Help?
173+
174+
- Check [GitHub Issues](https://github.com/mem0ai/mem0/issues)
175+
- Read the [documentation](https://docs.mem0.ai/)
176+
- Open a new issue if you're stuck
177+
178+
---
179+
180+
## Advanced: Configuration Changes
181+
182+
**If you configured vector stores with version:**
183+
184+
```python
185+
# Before
186+
config = MemoryConfig(
187+
version="v1.1",
188+
vector_store=VectorStoreConfig(...)
189+
)
190+
191+
# After
192+
config = MemoryConfig(
193+
vector_store=VectorStoreConfig(...)
194+
)
195+
```
196+
197+
---
198+
199+
## Testing Your Migration
200+
201+
Quick sanity check:
202+
203+
```python
204+
from mem0 import Memory
205+
206+
memory = Memory()
207+
208+
# Add should return a dict with "results"
209+
result = memory.add("I like pizza", user_id="test")
210+
assert "results" in result
211+
212+
# Search should return a dict with "results"
213+
search = memory.search("food", user_id="test")
214+
assert "results" in search
215+
216+
# Get all should return a dict with "results"
217+
all_memories = memory.get_all(user_id="test")
218+
assert "results" in all_memories
219+
220+
print("✅ Migration successful!")
221+
```

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
<strong>⚡ +26% Accuracy vs. OpenAI Memory • 🚀 91% Faster • 💰 90% Fewer Tokens</strong>
4848
</p>
4949

50+
> **🎉 mem0ai v1.0.0 is now available!** This major release includes API modernization, improved vector store support, and enhanced GCP integration. [See migration guide →](MIGRATION_GUIDE_v1.0.md)
51+
5052
## 🔥 Research Highlights
5153
- **+26% Accuracy** over OpenAI Memory on the LOCOMO benchmark
5254
- **91% Faster Responses** than full-context, ensuring low-latency at scale

docs/_snippets/paper-release.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<Note type="info">
2-
📢 Announcing our research paper: Mem0 achieves <strong>26%</strong> higher accuracy than OpenAI Memory, <strong>91%</strong> lower latency, and <strong>90%</strong> token savings! [Read the paper](https://mem0.ai/research) to learn how we're revolutionizing AI agent memory.
2+
<strong>🎉 Mem0 1.0.0 is here!</strong> Enhanced filtering, reranking, and smarter memory management.
33
</Note>

docs/api-reference/memory/v2-get-memories.mdx renamed to docs/api-reference/memory/get-memories.mdx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ memories = m.get_all(
2525
"created_at": {"gte": "2024-07-01", "lte": "2024-07-31"}
2626
}
2727
]
28-
},
29-
version="v2"
28+
}
3029
)
3130
```
3231

@@ -58,8 +57,7 @@ memories = m.get_all(
5857
"run_id": "*"
5958
}
6059
]
61-
},
62-
version="v2"
60+
}
6361
)
6462
```
6563
</CodeGroup>

docs/api-reference/memory/v2-search-memories.mdx renamed to docs/api-reference/memory/search-memories.mdx

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: 'Search Memories (v2)'
2+
title: 'Search Memories'
33
openapi: post /v2/memories/search/
44
---
55

@@ -17,7 +17,6 @@ The v2 search API is powerful and flexible, allowing for more precise memory ret
1717
```python Code
1818
related_memories = m.search(
1919
query="What are Alice's hobbies?",
20-
version="v2",
2120
filters={
2221
"OR": [
2322
{
@@ -56,7 +55,6 @@ related_memories = m.search(
5655
# Using wildcard to match all run_ids for a specific user
5756
all_memories = m.search(
5857
query="What are Alice's hobbies?",
59-
version="v2",
6058
filters={
6159
"AND": [
6260
{
@@ -76,7 +74,6 @@ all_memories = m.search(
7674
# Example 1: Using 'contains' for partial matching
7775
finance_memories = m.search(
7876
query="What are my financial goals?",
79-
version="v2",
8077
filters={
8178
"AND": [
8279
{ "user_id": "alice" },
@@ -92,7 +89,6 @@ finance_memories = m.search(
9289
# Example 2: Using 'in' for exact matching
9390
personal_memories = m.search(
9491
query="What personal information do you have?",
95-
version="v2",
9692
filters={
9793
"AND": [
9894
{ "user_id": "alice" },
@@ -106,11 +102,3 @@ personal_memories = m.search(
106102
)
107103
```
108104
</CodeGroup>
109-
110-
## Graph Memory
111-
112-
To retrieve memories with graph-based relationships, pass the `enable_graph=True` parameter. This includes relationship data in the response for more contextual results.
113-
114-
<Note>
115-
Learn more in the [Graph Memory documentation](/platform/features/graph-memory).
116-
</Note>

0 commit comments

Comments
 (0)