Doc update (#2065)
This commit is contained in:
4
docs/api-reference/memory/batch-delete.mdx
Normal file
4
docs/api-reference/memory/batch-delete.mdx
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
title: 'Batch Delete Memories'
|
||||||
|
openapi: delete /v1/memories/batch/
|
||||||
|
---
|
||||||
4
docs/api-reference/memory/batch-update.mdx
Normal file
4
docs/api-reference/memory/batch-update.mdx
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
title: 'Batch Update Memories'
|
||||||
|
openapi: put /v1/memories/batch/
|
||||||
|
---
|
||||||
@@ -158,7 +158,9 @@
|
|||||||
"api-reference/memory/delete-memory",
|
"api-reference/memory/delete-memory",
|
||||||
"api-reference/memory/v1-search-memories",
|
"api-reference/memory/v1-search-memories",
|
||||||
"api-reference/memory/v2-search-memories",
|
"api-reference/memory/v2-search-memories",
|
||||||
"api-reference/memory/history-memory"
|
"api-reference/memory/history-memory",
|
||||||
|
"api-reference/memory/batch-update",
|
||||||
|
"api-reference/memory/batch-delete"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3579,6 +3579,172 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"/v1/memories/batch/": {
|
||||||
|
"put": {
|
||||||
|
"tags": [
|
||||||
|
"memories"
|
||||||
|
],
|
||||||
|
"description": "Batch update multiple memories (up to 1000) in a single API call.",
|
||||||
|
"operationId": "memories_batch_update",
|
||||||
|
"requestBody": {
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"memories": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"required": ["memory_id", "text"],
|
||||||
|
"properties": {
|
||||||
|
"memory_id": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "uuid",
|
||||||
|
"description": "The unique identifier of the memory to update"
|
||||||
|
},
|
||||||
|
"text": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The new text content for the memory"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"maxItems": 1000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["memories"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Successfully updated memories",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"message": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "Successfully updated 2 memories"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"error": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "Maximum of 1000 memories can be updated in a single request"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-code-samples": [
|
||||||
|
{
|
||||||
|
"lang": "Python",
|
||||||
|
"source": "# To use the Python SDK, install the package:\n# pip install mem0ai\n\nfrom mem0 import MemoryClient\nclient = MemoryClient(api_key=\"your-api-key\")\n\nupdate_memories = [\n {\n \"memory_id\": \"285ed74b-6e05-4043-b16b-3abd5b533496\",\n \"text\": \"Watches football\"\n },\n {\n \"memory_id\": \"2c9bd859-d1b7-4d33-a6b8-94e0147c4f07\",\n \"text\": \"Likes to travel\"\n }\n]\n\nresponse = client.batch_update(update_memories)\nprint(response)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"lang": "JavaScript",
|
||||||
|
"source": "// To use the JavaScript SDK, install the package:\n// npm i mem0ai\n\nimport MemoryClient from 'mem0ai';\nconst client = new MemoryClient({ apiKey: \"your-api-key\" });\n\nconst updateMemories = [\n {\n memoryId: \"285ed74b-6e05-4043-b16b-3abd5b533496\",\n text: \"Watches football\"\n },\n {\n memoryId: \"2c9bd859-d1b7-4d33-a6b8-94e0147c4f07\",\n text: \"Likes to travel\"\n }\n];\n\nclient.batchUpdate(updateMemories)\n .then(response => console.log('Batch update response:', response))\n .catch(error => console.error(error));"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"lang": "cURL",
|
||||||
|
"source": "curl -X PUT \"https://api.mem0.ai/v1/memories/batch/\" \\\n -H \"Authorization: Token your-api-key\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"memories\": [\n {\n \"memory_id\": \"285ed74b-6e05-4043-b16b-3abd5b533496\",\n \"text\": \"Watches football\"\n },\n {\n \"memory_id\": \"2c9bd859-d1b7-4d33-a6b8-94e0147c4f07\",\n \"text\": \"Likes to travel\"\n }\n ]\n }'"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"delete": {
|
||||||
|
"tags": [
|
||||||
|
"memories"
|
||||||
|
],
|
||||||
|
"description": "Batch delete multiple memories (up to 1000) in a single API call.",
|
||||||
|
"operationId": "memories_batch_delete",
|
||||||
|
"requestBody": {
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"memory_ids": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "uuid"
|
||||||
|
},
|
||||||
|
"maxItems": 1000,
|
||||||
|
"description": "Array of memory IDs to delete"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["memory_ids"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Successfully deleted memories",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"message": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "Successfully deleted 2 memories"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"error": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "Maximum of 1000 memories can be deleted in a single request"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"x-code-samples": [
|
||||||
|
{
|
||||||
|
"lang": "Python",
|
||||||
|
"source": "# To use the Python SDK, install the package:\n# pip install mem0ai\n\nfrom mem0 import MemoryClient\nclient = MemoryClient(api_key=\"your-api-key\")\n\ndelete_memories = [\n \"285ed74b-6e05-4043-b16b-3abd5b533496\",\n \"2c9bd859-d1b7-4d33-a6b8-94e0147c4f07\"\n]\n\nresponse = client.batch_delete(delete_memories)\nprint(response)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"lang": "JavaScript",
|
||||||
|
"source": "// To use the JavaScript SDK, install the package:\n// npm i mem0ai\n\nimport MemoryClient from 'mem0ai';\nconst client = new MemoryClient({ apiKey: \"your-api-key\" });\n\nconst deleteMemories = [\n \"285ed74b-6e05-4043-b16b-3abd5b533496\",\n \"2c9bd859-d1b7-4d33-a6b8-94e0147c4f07\"\n];\n\nclient.batchDelete(deleteMemories)\n .then(response => console.log('Batch delete response:', response))\n .catch(error => console.error(error));"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"lang": "cURL",
|
||||||
|
"source": "curl -X DELETE \"https://api.mem0.ai/v1/memories/batch/\" \\\n -H \"Authorization: Token your-api-key\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"memory_ids\": [\n \"285ed74b-6e05-4043-b16b-3abd5b533496\",\n \"2c9bd859-d1b7-4d33-a6b8-94e0147c4f07\"\n ]\n }'"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"components": {
|
"components": {
|
||||||
|
|||||||
@@ -1508,6 +1508,103 @@ curl -X POST "https://api.mem0.ai/v1/memories/" \
|
|||||||
|
|
||||||
</CodeGroup>
|
</CodeGroup>
|
||||||
|
|
||||||
|
### 4.9 Batch Update Memories
|
||||||
|
Update multiple memories in a single API call. You can update up to 1000 memories at once.
|
||||||
|
<CodeGroup>
|
||||||
|
```python Python
|
||||||
|
update_memories = [
|
||||||
|
{
|
||||||
|
"memory_id": "285ed74b-6e05-4043-b16b-3abd5b533496",
|
||||||
|
"text": "Watches football"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"memory_id": "2c9bd859-d1b7-4d33-a6b8-94e0147c4f07",
|
||||||
|
"text": "Loves to travel"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
response = client.batch_update(update_memories)
|
||||||
|
print(response)
|
||||||
|
```
|
||||||
|
```javascript JavaScript
|
||||||
|
const updateMemories = [
|
||||||
|
{
|
||||||
|
memoryId: "285ed74b-6e05-4043-b16b-3abd5b533496",
|
||||||
|
text: "Watches football"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
memoryId: "2c9bd859-d1b7-4d33-a6b8-94e0147c4f07",
|
||||||
|
text: "Loves to travel"
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
client.batchUpdate(updateMemories)
|
||||||
|
.then(response => console.log('Batch update response:', response))
|
||||||
|
.catch(error => console.error(error));
|
||||||
|
```
|
||||||
|
```bash cURL
|
||||||
|
curl -X PUT "https://api.mem0.ai/v1/memories/batch/" \
|
||||||
|
-H "Authorization: Token your-api-key" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d '{
|
||||||
|
"memories": [
|
||||||
|
{
|
||||||
|
"memory_id": "285ed74b-6e05-4043-b16b-3abd5b533496",
|
||||||
|
"text": "Watches football"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"memory_id": "2c9bd859-d1b7-4d33-a6b8-94e0147c4f07",
|
||||||
|
"text": "Loves to travel"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}'
|
||||||
|
```
|
||||||
|
```json Output
|
||||||
|
{
|
||||||
|
"message": "Successfully updated 2 memories"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
</CodeGroup>
|
||||||
|
### 4.10 Batch Delete Memories
|
||||||
|
Delete multiple memories in a single API call. You can delete up to 1000 memories at once.
|
||||||
|
<CodeGroup>
|
||||||
|
```python Python
|
||||||
|
delete_memories = [
|
||||||
|
"285ed74b-6e05-4043-b16b-3abd5b533496",
|
||||||
|
"2c9bd859-d1b7-4d33-a6b8-94e0147c4f07"
|
||||||
|
]
|
||||||
|
|
||||||
|
response = client.batch_delete(delete_memories)
|
||||||
|
print(response)
|
||||||
|
```
|
||||||
|
```javascript JavaScript
|
||||||
|
const deleteMemories = [
|
||||||
|
"285ed74b-6e05-4043-b16b-3abd5b533496",
|
||||||
|
"2c9bd859-d1b7-4d33-a6b8-94e0147c4f07"
|
||||||
|
];
|
||||||
|
|
||||||
|
client.batchDelete(deleteMemories)
|
||||||
|
.then(response => console.log('Batch delete response:', response))
|
||||||
|
.catch(error => console.error(error));
|
||||||
|
```
|
||||||
|
```bash cURL
|
||||||
|
curl -X DELETE "https://api.mem0.ai/v1/memories/batch/" \
|
||||||
|
-H "Authorization: Token your-api-key" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d '{
|
||||||
|
"memory_ids": [
|
||||||
|
"285ed74b-6e05-4043-b16b-3abd5b533496",
|
||||||
|
"2c9bd859-d1b7-4d33-a6b8-94e0147c4f07"
|
||||||
|
]
|
||||||
|
}'
|
||||||
|
```
|
||||||
|
```json Output
|
||||||
|
{
|
||||||
|
"message": "Successfully deleted 2 memories"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
</CodeGroup>
|
||||||
|
|
||||||
If you have any questions, please feel free to reach out to us using one of the following methods:
|
If you have any questions, please feel free to reach out to us using one of the following methods:
|
||||||
|
|
||||||
<Snippet file="get-help.mdx" />
|
<Snippet file="get-help.mdx" />
|
||||||
Reference in New Issue
Block a user