Enhance update method to support metadata (#2976)

This commit is contained in:
Prateek Chhikara
2025-06-18 10:07:18 -07:00
committed by GitHub
parent 9eb4e77c75
commit cdee6a4ff0
3 changed files with 506 additions and 111 deletions

View File

@@ -1780,24 +1780,26 @@ curl -X GET "https://api.mem0.ai/v1/memories/<memory-id-here>/history/" \
### 4.6 Update Memory ### 4.6 Update Memory
Update a memory with new data. Update a memory with new data. You can update the memory's text, metadata, or both.
<CodeGroup> <CodeGroup>
```python Python ```python Python
message = "I recently tried chicken and I loved it. I'm thinking of trying more non-vegetarian dishes.." client.update(
client.update(memory_id, message) memory_id="<memory-id-here>",
text="I am now a vegetarian.",
metadata={"diet": "vegetarian"}
)
``` ```
```javascript JavaScript ```javascript JavaScript
const message = "I recently tried chicken and I loved it. I'm thinking of trying more non-vegetarian dishes.."; client.update("memory-id-here", { text: "I am now a vegetarian.", metadata: { diet: "vegetarian" } })
client.update("memory-id-here", message)
.then(result => console.log(result)) .then(result => console.log(result))
.catch(error => console.error(error)); .catch(error => console.error(error));
``` ```
```bash cURL ```bash cURL
curl -X PUT "https://api.mem0.ai/v1/memories/memory-id-here" \ curl -X PUT "https://api.mem0.ai/v1/memories/<memory-id-here>" \
-H "Authorization: Token your-api-key" \ -H "Authorization: Token your-api-key" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d '{ -d '{

File diff suppressed because it is too large Load Diff

View File

@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project] [project]
name = "mem0ai" name = "mem0ai"
version = "0.1.108" version = "0.1.109"
description = "Long-term memory for AI Agents" description = "Long-term memory for AI Agents"
authors = [ authors = [
{ name = "Mem0", email = "founders@mem0.ai" } { name = "Mem0", email = "founders@mem0.ai" }