(Docs) Updated Docs to Include V2 Paginated/Non-Paginated Output (#2056)
This commit is contained in:
@@ -722,28 +722,16 @@ The following examples showcase the paginated output format.
|
|||||||
<CodeGroup>
|
<CodeGroup>
|
||||||
|
|
||||||
```python Python
|
```python Python
|
||||||
memories = client.get_all(user_id="alex")
|
|
||||||
|
|
||||||
# Custom pagination
|
|
||||||
memories = client.get_all(user_id="alex", page=1, page_size=50)
|
memories = client.get_all(user_id="alex", page=1, page_size=50)
|
||||||
```
|
```
|
||||||
|
|
||||||
```javascript JavaScript
|
```javascript JavaScript
|
||||||
client.getAll({ user_id: "alex" })
|
|
||||||
.then(memories => console.log(memories))
|
|
||||||
.catch(error => console.error(error));
|
|
||||||
|
|
||||||
// Custom pagination
|
|
||||||
client.getAll({ user_id: "alex", page: 1, page_size: 50 })
|
client.getAll({ user_id: "alex", page: 1, page_size: 50 })
|
||||||
.then(memories => console.log(memories))
|
.then(memories => console.log(memories))
|
||||||
.catch(error => console.error(error));
|
.catch(error => console.error(error));
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash cURL
|
```bash cURL
|
||||||
curl -X GET "https://api.mem0.ai/v1/memories/?user_id=alex" \
|
|
||||||
-H "Authorization: Token your-api-key"
|
|
||||||
|
|
||||||
# Custom pagination
|
|
||||||
curl -X GET "https://api.mem0.ai/v1/memories/?user_id=alex&page=1&page_size=50" \
|
curl -X GET "https://api.mem0.ai/v1/memories/?user_id=alex&page=1&page_size=50" \
|
||||||
-H "Authorization: Token your-api-key"
|
-H "Authorization: Token your-api-key"
|
||||||
```
|
```
|
||||||
@@ -819,28 +807,16 @@ curl -X GET "https://api.mem0.ai/v1/memories/?user_id=alex&page=1&page_size=50"
|
|||||||
|
|
||||||
<CodeGroup>
|
<CodeGroup>
|
||||||
```python Python
|
```python Python
|
||||||
client.get_all(agent_id="ai-tutor")
|
agent_memories = client.get_all(agent_id="ai-tutor", page=1, page_size=50)
|
||||||
|
|
||||||
# Custom pagination
|
|
||||||
client.get_all(agent_id="ai-tutor", page=1, page_size=50)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```javascript JavaScript
|
```javascript JavaScript
|
||||||
client.getAll({ agent_id: "ai-tutor" })
|
|
||||||
.then(memories => console.log(memories))
|
|
||||||
.catch(error => console.error(error));
|
|
||||||
|
|
||||||
// Custom pagination
|
|
||||||
client.getAll({ agent_id: "ai-tutor", page: 1, page_size: 50 })
|
client.getAll({ agent_id: "ai-tutor", page: 1, page_size: 50 })
|
||||||
.then(memories => console.log(memories))
|
.then(memories => console.log(memories))
|
||||||
.catch(error => console.error(error));
|
.catch(error => console.error(error));
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash cURL
|
```bash cURL
|
||||||
curl -X GET "https://api.mem0.ai/v1/memories/?agent_id=ai-tutor" \
|
|
||||||
-H "Authorization: Token your-api-key"
|
|
||||||
|
|
||||||
# Custom pagination
|
|
||||||
curl -X GET "https://api.mem0.ai/v1/memories/?agent_id=ai-tutor&page=1&page_size=50" \
|
curl -X GET "https://api.mem0.ai/v1/memories/?agent_id=ai-tutor&page=1&page_size=50" \
|
||||||
-H "Authorization: Token your-api-key"
|
-H "Authorization: Token your-api-key"
|
||||||
```
|
```
|
||||||
@@ -913,28 +889,16 @@ curl -X GET "https://api.mem0.ai/v1/memories/?agent_id=ai-tutor&page=1&page_size
|
|||||||
<CodeGroup>
|
<CodeGroup>
|
||||||
|
|
||||||
```python Python
|
```python Python
|
||||||
short_term_memories = client.get_all(user_id="alex123", run_id="trip-planning-2024")
|
|
||||||
|
|
||||||
# Custom pagination
|
|
||||||
short_term_memories = client.get_all(user_id="alex123", run_id="trip-planning-2024", page=1, page_size=50)
|
short_term_memories = client.get_all(user_id="alex123", run_id="trip-planning-2024", page=1, page_size=50)
|
||||||
```
|
```
|
||||||
|
|
||||||
```javascript JavaScript
|
```javascript JavaScript
|
||||||
client.getAll({ user_id: "alex123", run_id: "trip-planning-2024" })
|
|
||||||
.then(memories => console.log(memories))
|
|
||||||
.catch(error => console.error(error));
|
|
||||||
|
|
||||||
// Custom pagination
|
|
||||||
client.getAll({ user_id: "alex123", run_id: "trip-planning-2024", page: 1, page_size: 50 })
|
client.getAll({ user_id: "alex123", run_id: "trip-planning-2024", page: 1, page_size: 50 })
|
||||||
.then(memories => console.log(memories))
|
.then(memories => console.log(memories))
|
||||||
.catch(error => console.error(error));
|
.catch(error => console.error(error));
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash cURL
|
```bash cURL
|
||||||
curl -X GET "https://api.mem0.ai/v1/memories/?user_id=alex123&run_id=trip-planning-2024" \
|
|
||||||
-H "Authorization: Token your-api-key"
|
|
||||||
|
|
||||||
# Custom pagination
|
|
||||||
curl -X GET "https://api.mem0.ai/v1/memories/?user_id=alex123&run_id=trip-planning-2024&page=1&page_size=50" \
|
curl -X GET "https://api.mem0.ai/v1/memories/?user_id=alex123&run_id=trip-planning-2024&page=1&page_size=50" \
|
||||||
-H "Authorization: Token your-api-key"
|
-H "Authorization: Token your-api-key"
|
||||||
```
|
```
|
||||||
@@ -1082,7 +1046,12 @@ filters = {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Default (No Pagination)
|
||||||
client.get_all(version="v2", filters=filters)
|
client.get_all(version="v2", filters=filters)
|
||||||
|
|
||||||
|
# Pagination (You can also use the page and page_size parameters)
|
||||||
|
client.get_all(version="v2", filters=filters, page=1, page_size=50)
|
||||||
```
|
```
|
||||||
|
|
||||||
```javascript JavaScript
|
```javascript JavaScript
|
||||||
@@ -1099,12 +1068,20 @@ const filters = {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Default (No Pagination)
|
||||||
client.getAll({ version: "v2", filters })
|
client.getAll({ version: "v2", filters })
|
||||||
.then(memories => console.log(memories))
|
.then(memories => console.log(memories))
|
||||||
.catch(error => console.error(error));
|
.catch(error => console.error(error));
|
||||||
|
|
||||||
|
// Pagination (You can also use the page and page_size parameters)
|
||||||
|
client.getAll({ version: "v2", filters, page: 1, page_size: 50 })
|
||||||
|
.then(memories => console.log(memories))
|
||||||
|
.catch(error => console.error(error));
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash cURL
|
```bash cURL
|
||||||
|
# Default (No Pagination)
|
||||||
curl -X GET "https://api.mem0.ai/v1/memories/?version=v2" \
|
curl -X GET "https://api.mem0.ai/v1/memories/?version=v2" \
|
||||||
-H "Authorization: Token your-api-key" \
|
-H "Authorization: Token your-api-key" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
@@ -1123,9 +1100,29 @@ curl -X GET "https://api.mem0.ai/v1/memories/?version=v2" \
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
}'
|
}'
|
||||||
|
|
||||||
|
# Pagination (You can also use the page and page_size parameters)
|
||||||
|
curl -X GET "https://api.mem0.ai/v1/memories/?version=v2&page=1&page_size=50" \
|
||||||
|
-H "Authorization: Token your-api-key" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d '{
|
||||||
|
"filters": {
|
||||||
|
"AND": [
|
||||||
|
{
|
||||||
|
"user_id": "alex"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"created_at": {
|
||||||
|
"gte": "2024-07-01",
|
||||||
|
"lte": "2024-07-31"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}'
|
||||||
```
|
```
|
||||||
|
|
||||||
```json Output
|
```json Output (Default)
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"id":"f38b689d-6b24-45b7-bced-17fbb4d8bac7",
|
"id":"f38b689d-6b24-45b7-bced-17fbb4d8bac7",
|
||||||
@@ -1139,6 +1136,27 @@ curl -X GET "https://api.mem0.ai/v1/memories/?version=v2" \
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```json Output (Paginated)
|
||||||
|
{
|
||||||
|
"count": 1,
|
||||||
|
"next": null,
|
||||||
|
"previous": null,
|
||||||
|
"results": [
|
||||||
|
{
|
||||||
|
"id":"f38b689d-6b24-45b7-bced-17fbb4d8bac7",
|
||||||
|
"memory":"Name: Alex. Vegetarian. Allergic to nuts.",
|
||||||
|
"user_id":"alex",
|
||||||
|
"hash":"62bc074f56d1f909f1b4c2b639f56f6a",
|
||||||
|
"metadata":null,
|
||||||
|
"created_at":"2024-07-25T23:57:00.108347-07:00",
|
||||||
|
"updated_at":"2024-07-25T23:57:00.108367-07:00",
|
||||||
|
"categories": ["food_preferences"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
</CodeGroup>
|
</CodeGroup>
|
||||||
|
|
||||||
### 4.5 Memory History
|
### 4.5 Memory History
|
||||||
|
|||||||
Reference in New Issue
Block a user