[Mem0] Add support for getting all users in python client (#1672)

This commit is contained in:
Deshraj Yadav
2024-08-09 00:27:54 -07:00
committed by GitHub
parent e570888437
commit d1c5c70b4c
3 changed files with 62 additions and 1 deletions

View File

@@ -230,6 +230,59 @@ curl -X POST "https://api.mem0.ai/v1/memories/search/" \
```
</CodeGroup>
### 4.3 Get all users
Get all users, agents, and sessions for which memories exist.
<CodeGroup>
```python Python
client.users()
```
```javascript JavaScript
client.users()
.then(users => console.log(users))
.catch(error => console.error(error));
```
```bash cURL
curl -X GET "https://api.mem0.ai/v1/entities/" \
-H "Authorization: Token your-api-key"
```
```json Output
[
{
"id": "1",
"name": "user123",
"created_at": "2024-07-17T16:47:23.899900-07:00",
"updated_at": "2024-07-17T16:47:23.899918-07:00",
"total_memories": 5,
"owner": "alex",
"organization": "alex-org",
"metadata": {"foo": "bar"},
"type": "user"
},
{
"id": "2",
"name": "travel-agent",
"created_at": "2024-07-01T17:59:08.187250-07:00",
"updated_at": "2024-07-01T17:59:08.187266-07:00",
"total_memories": 10,
"owner": "alex",
"organization": "alex-org",
"metadata": {"agent_id": "123"},
"type": "agent"
}
]
```
</CodeGroup>
### 4.3 Get All Memories
Fetch all memories for a user, agent, or session using the getAll() method.