fix: refresh stale mem0ai pins in examples and openclaw (#5212)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
5a2201d76b
commit
098a599579
@@ -1,221 +0,0 @@
|
|||||||
# Migration Guide: Upgrading to mem0 1.0.0
|
|
||||||
|
|
||||||
## TL;DR
|
|
||||||
|
|
||||||
**What changed?** We simplified the API by removing confusing version parameters. Now everything returns a consistent format: `{"results": [...]}`.
|
|
||||||
|
|
||||||
**What you need to do:**
|
|
||||||
1. Upgrade: `pip install mem0ai==1.0.0`
|
|
||||||
2. Remove `version` and `output_format` parameters from your code
|
|
||||||
3. Update response handling to use `result["results"]` instead of treating responses as lists
|
|
||||||
|
|
||||||
**Time needed:** ~5-10 minutes for most projects
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Quick Migration Guide
|
|
||||||
|
|
||||||
### 1. Install the Update
|
|
||||||
|
|
||||||
```bash
|
|
||||||
pip install mem0ai==1.0.0
|
|
||||||
```
|
|
||||||
|
|
||||||
### 2. Update Your Code
|
|
||||||
|
|
||||||
**If you're using the Memory API:**
|
|
||||||
|
|
||||||
```python
|
|
||||||
# Before
|
|
||||||
memory = Memory(config=MemoryConfig(version="v1.1"))
|
|
||||||
result = memory.add("I like pizza")
|
|
||||||
|
|
||||||
# After
|
|
||||||
memory = Memory() # That's it - version is automatic now
|
|
||||||
result = memory.add("I like pizza")
|
|
||||||
```
|
|
||||||
|
|
||||||
**If you're using the Client API:**
|
|
||||||
|
|
||||||
```python
|
|
||||||
# Before
|
|
||||||
client.add(messages, output_format="v1.1")
|
|
||||||
client.search(query, version="v2", output_format="v1.1")
|
|
||||||
|
|
||||||
# After
|
|
||||||
client.add(messages) # Just remove those extra parameters
|
|
||||||
client.search(query)
|
|
||||||
```
|
|
||||||
|
|
||||||
### 3. Update How You Handle Responses
|
|
||||||
|
|
||||||
All responses now use the same format: a dictionary with `"results"` key.
|
|
||||||
|
|
||||||
```python
|
|
||||||
# Before - you might have done this
|
|
||||||
result = memory.add("I like pizza")
|
|
||||||
for item in result: # Treating it as a list
|
|
||||||
print(item)
|
|
||||||
|
|
||||||
# After - do this instead
|
|
||||||
result = memory.add("I like pizza")
|
|
||||||
for item in result["results"]: # Access the results key
|
|
||||||
print(item)
|
|
||||||
|
|
||||||
# Graph relations (if you use them)
|
|
||||||
if "relations" in result:
|
|
||||||
for relation in result["relations"]:
|
|
||||||
print(relation)
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Enhanced Message Handling
|
|
||||||
|
|
||||||
The platform client (MemoryClient) now supports the same flexible message formats as the OSS version:
|
|
||||||
|
|
||||||
```python
|
|
||||||
from mem0 import MemoryClient
|
|
||||||
|
|
||||||
client = MemoryClient(api_key="your-key")
|
|
||||||
|
|
||||||
# All three formats now work:
|
|
||||||
|
|
||||||
# 1. Single string (automatically converted to user message)
|
|
||||||
client.add("I like pizza", user_id="alice")
|
|
||||||
|
|
||||||
# 2. Single message dictionary
|
|
||||||
client.add({"role": "user", "content": "I like pizza"}, user_id="alice")
|
|
||||||
|
|
||||||
# 3. List of messages (conversation)
|
|
||||||
client.add([
|
|
||||||
{"role": "user", "content": "I like pizza"},
|
|
||||||
{"role": "assistant", "content": "I'll remember that!"}
|
|
||||||
], user_id="alice")
|
|
||||||
```
|
|
||||||
|
|
||||||
### Async Mode Configuration
|
|
||||||
|
|
||||||
The `async_mode` parameter now defaults to `True` but can be configured:
|
|
||||||
|
|
||||||
```python
|
|
||||||
# Default behavior (async_mode=True)
|
|
||||||
client.add(messages, user_id="alice")
|
|
||||||
|
|
||||||
# Explicitly set async mode
|
|
||||||
client.add(messages, user_id="alice", async_mode=True)
|
|
||||||
|
|
||||||
# Disable async mode if needed
|
|
||||||
client.add(messages, user_id="alice", async_mode=False)
|
|
||||||
```
|
|
||||||
|
|
||||||
**Note:** `async_mode=True` provides better performance for most use cases. Only set it to `False` if you have specific synchronous processing requirements.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## That's It!
|
|
||||||
|
|
||||||
For most users, that's all you need to know. The changes are:
|
|
||||||
- ✅ No more `version` or `output_format` parameters
|
|
||||||
- ✅ Consistent `{"results": [...]}` response format
|
|
||||||
- ✅ Cleaner, simpler API
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Common Issues
|
|
||||||
|
|
||||||
**Getting `KeyError: 'results'`?**
|
|
||||||
|
|
||||||
Your code is still treating the response as a list. Update it:
|
|
||||||
```python
|
|
||||||
# Change this:
|
|
||||||
for memory in response:
|
|
||||||
|
|
||||||
# To this:
|
|
||||||
for memory in response["results"]:
|
|
||||||
```
|
|
||||||
|
|
||||||
**Getting `TypeError: unexpected keyword argument`?**
|
|
||||||
|
|
||||||
You're still passing old parameters. Remove them:
|
|
||||||
```python
|
|
||||||
# Change this:
|
|
||||||
client.add(messages, output_format="v1.1")
|
|
||||||
|
|
||||||
# To this:
|
|
||||||
client.add(messages)
|
|
||||||
```
|
|
||||||
|
|
||||||
**Seeing deprecation warnings?**
|
|
||||||
|
|
||||||
Remove any explicit `version="v1.0"` from your config:
|
|
||||||
```python
|
|
||||||
# Change this:
|
|
||||||
memory = Memory(config=MemoryConfig(version="v1.0"))
|
|
||||||
|
|
||||||
# To this:
|
|
||||||
memory = Memory()
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## What's New in 1.0.0
|
|
||||||
|
|
||||||
- **Better vector stores:** Fixed OpenSearch and improved reliability across all stores
|
|
||||||
- **Cleaner API:** One way to do things, no more confusing options
|
|
||||||
- **Enhanced GCP support:** Better Vertex AI configuration options
|
|
||||||
- **Flexible message input:** Platform client now accepts strings, dicts, and lists (aligned with OSS)
|
|
||||||
- **Configurable async_mode:** Now defaults to `True` but users can override if needed
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Need Help?
|
|
||||||
|
|
||||||
- Check [GitHub Issues](https://github.com/mem0ai/mem0/issues)
|
|
||||||
- Read the [documentation](https://docs.mem0.ai/)
|
|
||||||
- Open a new issue if you're stuck
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Advanced: Configuration Changes
|
|
||||||
|
|
||||||
**If you configured vector stores with version:**
|
|
||||||
|
|
||||||
```python
|
|
||||||
# Before
|
|
||||||
config = MemoryConfig(
|
|
||||||
version="v1.1",
|
|
||||||
vector_store=VectorStoreConfig(...)
|
|
||||||
)
|
|
||||||
|
|
||||||
# After
|
|
||||||
config = MemoryConfig(
|
|
||||||
vector_store=VectorStoreConfig(...)
|
|
||||||
)
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Testing Your Migration
|
|
||||||
|
|
||||||
Quick sanity check:
|
|
||||||
|
|
||||||
```python
|
|
||||||
from mem0 import Memory
|
|
||||||
|
|
||||||
memory = Memory()
|
|
||||||
|
|
||||||
# Add should return a dict with "results"
|
|
||||||
result = memory.add("I like pizza", user_id="test")
|
|
||||||
assert "results" in result
|
|
||||||
|
|
||||||
# Search should return a dict with "results"
|
|
||||||
search = memory.search("food", user_id="test")
|
|
||||||
assert "results" in search
|
|
||||||
|
|
||||||
# Get all should return a dict with "results"
|
|
||||||
all_memories = memory.get_all(user_id="test")
|
|
||||||
assert "results" in all_memories
|
|
||||||
|
|
||||||
print("✅ Migration successful!")
|
|
||||||
```
|
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sinclair/typebox": "0.34.47",
|
"@sinclair/typebox": "0.34.47",
|
||||||
"mem0ai": "3.0.2"
|
"mem0ai": "3.0.3"
|
||||||
},
|
},
|
||||||
"openclaw": {
|
"openclaw": {
|
||||||
"extensions": [
|
"extensions": [
|
||||||
|
|||||||
Generated
+8
-5
@@ -15,8 +15,8 @@ importers:
|
|||||||
specifier: 0.34.47
|
specifier: 0.34.47
|
||||||
version: 0.34.47
|
version: 0.34.47
|
||||||
mem0ai:
|
mem0ai:
|
||||||
specifier: 3.0.2
|
specifier: 3.0.3
|
||||||
version: 3.0.2(@anthropic-ai/sdk@0.40.1)(@azure/identity@4.13.0)(@azure/search-documents@12.2.0)(@cloudflare/workers-types@4.20260313.1)(@google/genai@1.45.0)(@langchain/core@0.3.80(openai@4.104.0(ws@8.19.0)(zod@3.25.76)))(@mistralai/mistralai@1.15.1)(@qdrant/js-client-rest@1.13.0(typescript@5.9.3))(@supabase/supabase-js@2.99.1)(@types/jest@29.5.14)(@types/pg@8.11.0)(better-sqlite3@12.8.0)(cloudflare@4.5.0)(compromise@14.15.0)(groq-sdk@0.3.0)(natural@8.1.1)(ollama@0.5.18)(pg@8.20.0)(redis@5.12.1)(ws@8.19.0)
|
version: 3.0.3(@anthropic-ai/sdk@0.40.1)(@azure/identity@4.13.0)(@azure/search-documents@12.2.0)(@cloudflare/workers-types@4.20260313.1)(@google/genai@1.45.0)(@langchain/core@0.3.80(openai@4.104.0(ws@8.19.0)(zod@3.25.76)))(@mistralai/mistralai@1.15.1)(@qdrant/js-client-rest@1.13.0(typescript@5.9.3))(@supabase/supabase-js@2.99.1)(@types/jest@29.5.14)(@types/pg@8.11.0)(better-sqlite3@12.8.0)(cloudflare@4.5.0)(compromise@14.15.0)(groq-sdk@0.3.0)(natural@8.1.1)(ollama@0.5.18)(pg@8.20.0)(redis@5.12.1)(ws@8.19.0)
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@types/node':
|
'@types/node':
|
||||||
specifier: ^22.15.0
|
specifier: ^22.15.0
|
||||||
@@ -1508,8 +1508,8 @@ packages:
|
|||||||
md5@2.3.0:
|
md5@2.3.0:
|
||||||
resolution: {integrity: sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==}
|
resolution: {integrity: sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==}
|
||||||
|
|
||||||
mem0ai@3.0.2:
|
mem0ai@3.0.3:
|
||||||
resolution: {integrity: sha512-smB9q27jrJu2D5WZje65+zMVptdS/WsqALxd2kjiZhEpThd/qkS8T3bumatcTu6Zb+LsT28FRpeWjXGTJjyQXQ==}
|
resolution: {integrity: sha512-nKwGYNh8DipG9Sw0ik/huFLpKtVtwadSy+T6GjAxkkrHp6hO3tlbR75EWH/bCGDG/HO06nYDsDP5fPSnj3bp5g==}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
'@anthropic-ai/sdk': ^0.40.1
|
'@anthropic-ai/sdk': ^0.40.1
|
||||||
@@ -2119,6 +2119,7 @@ packages:
|
|||||||
|
|
||||||
uuid@10.0.0:
|
uuid@10.0.0:
|
||||||
resolution: {integrity: sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==}
|
resolution: {integrity: sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==}
|
||||||
|
deprecated: uuid@10 and below is no longer supported. For ESM codebases, update to uuid@latest. For CommonJS codebases, use uuid@11 (but be aware this version will likely be deprecated in 2028).
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
uuid@13.0.0:
|
uuid@13.0.0:
|
||||||
@@ -2127,10 +2128,12 @@ packages:
|
|||||||
|
|
||||||
uuid@8.3.2:
|
uuid@8.3.2:
|
||||||
resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==}
|
resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==}
|
||||||
|
deprecated: uuid@10 and below is no longer supported. For ESM codebases, update to uuid@latest. For CommonJS codebases, use uuid@11 (but be aware this version will likely be deprecated in 2028).
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
uuid@9.0.1:
|
uuid@9.0.1:
|
||||||
resolution: {integrity: sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==}
|
resolution: {integrity: sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==}
|
||||||
|
deprecated: uuid@10 and below is no longer supported. For ESM codebases, update to uuid@latest. For CommonJS codebases, use uuid@11 (but be aware this version will likely be deprecated in 2028).
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
vite@8.0.0:
|
vite@8.0.0:
|
||||||
@@ -3690,7 +3693,7 @@ snapshots:
|
|||||||
crypt: 0.0.2
|
crypt: 0.0.2
|
||||||
is-buffer: 1.1.6
|
is-buffer: 1.1.6
|
||||||
|
|
||||||
mem0ai@3.0.2(@anthropic-ai/sdk@0.40.1)(@azure/identity@4.13.0)(@azure/search-documents@12.2.0)(@cloudflare/workers-types@4.20260313.1)(@google/genai@1.45.0)(@langchain/core@0.3.80(openai@4.104.0(ws@8.19.0)(zod@3.25.76)))(@mistralai/mistralai@1.15.1)(@qdrant/js-client-rest@1.13.0(typescript@5.9.3))(@supabase/supabase-js@2.99.1)(@types/jest@29.5.14)(@types/pg@8.11.0)(better-sqlite3@12.8.0)(cloudflare@4.5.0)(compromise@14.15.0)(groq-sdk@0.3.0)(natural@8.1.1)(ollama@0.5.18)(pg@8.20.0)(redis@5.12.1)(ws@8.19.0):
|
mem0ai@3.0.3(@anthropic-ai/sdk@0.40.1)(@azure/identity@4.13.0)(@azure/search-documents@12.2.0)(@cloudflare/workers-types@4.20260313.1)(@google/genai@1.45.0)(@langchain/core@0.3.80(openai@4.104.0(ws@8.19.0)(zod@3.25.76)))(@mistralai/mistralai@1.15.1)(@qdrant/js-client-rest@1.13.0(typescript@5.9.3))(@supabase/supabase-js@2.99.1)(@types/jest@29.5.14)(@types/pg@8.11.0)(better-sqlite3@12.8.0)(cloudflare@4.5.0)(compromise@14.15.0)(groq-sdk@0.3.0)(natural@8.1.1)(ollama@0.5.18)(pg@8.20.0)(redis@5.12.1)(ws@8.19.0):
|
||||||
dependencies:
|
dependencies:
|
||||||
'@anthropic-ai/sdk': 0.40.1
|
'@anthropic-ai/sdk': 0.40.1
|
||||||
'@azure/identity': 4.13.0
|
'@azure/identity': 4.13.0
|
||||||
|
|||||||
Reference in New Issue
Block a user