Enhance update method to support metadata (#2976)
This commit is contained in:
@@ -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
@@ -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" }
|
||||||
|
|||||||
Reference in New Issue
Block a user