Skip to content

Commit cdee6a4

Browse files
Enhance update method to support metadata (#2976)
1 parent 9eb4e77 commit cdee6a4

File tree

3 files changed

+505
-110
lines changed

3 files changed

+505
-110
lines changed

docs/platform/quickstart.mdx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1780,24 +1780,26 @@ curl -X GET "https://api.mem0.ai/v1/memories/<memory-id-here>/history/" \
17801780
17811781
### 4.6 Update Memory
17821782
1783-
Update a memory with new data.
1783+
Update a memory with new data. You can update the memory's text, metadata, or both.
17841784
17851785
<CodeGroup>
17861786
17871787
```python Python
1788-
message = "I recently tried chicken and I loved it. I'm thinking of trying more non-vegetarian dishes.."
1789-
client.update(memory_id, message)
1788+
client.update(
1789+
memory_id="<memory-id-here>",
1790+
text="I am now a vegetarian.",
1791+
metadata={"diet": "vegetarian"}
1792+
)
17901793
```
17911794
17921795
```javascript JavaScript
1793-
const message = "I recently tried chicken and I loved it. I'm thinking of trying more non-vegetarian dishes..";
1794-
client.update("memory-id-here", message)
1796+
client.update("memory-id-here", { text: "I am now a vegetarian.", metadata: { diet: "vegetarian" } })
17951797
.then(result => console.log(result))
17961798
.catch(error => console.error(error));
17971799
```
17981800
17991801
```bash cURL
1800-
curl -X PUT "https://api.mem0.ai/v1/memories/memory-id-here" \
1802+
curl -X PUT "https://api.mem0.ai/v1/memories/<memory-id-here>" \
18011803
-H "Authorization: Token your-api-key" \
18021804
-H "Content-Type: application/json" \
18031805
-d '{

0 commit comments

Comments
 (0)