Memory

Get session memory

GET
Returns a memory (latest summary, list of messages and facts for models.MemoryTypePerpetual) for a given session

Path parameters

sessionIdstringRequired
The ID of the session for which to retrieve memory.

Query parameters

memoryTypeenumOptional

The type of memory to retrieve: perpetual, summary_retriever, or message_window. Defaults to perpetual.

Allowed values: perpetualsummary_retrievermessage_window
lastnintegerOptional
The number of most recent memory entries to retrieve.

Response

This endpoint returns an object
facts
list of stringsOptional
Most recent list of facts derived from the session. Included only with perpetual memory type.
messages
list of objectsOptional
A list of message objects, where each message contains a role and content.
metadata
map from strings to anyOptional
A dictionary containing metadata associated with the memory.
relevant_summaries
list of objectsOptional
Summary list result from Summary Retriever Memory Type.
summary
objectOptional
A Summary object.

Errors

GET
1curl https://api.getzep.com/api/v2/sessions/sessionId/memory \
2 -H "Authorization: Api-Key <apiKey>"
1{
2 "facts": [
3 "facts"
4 ],
5 "messages": [
6 {
7 "content": "content",
8 "created_at": "created_at",
9 "role": "role",
10 "role_type": "norole",
11 "token_count": 1,
12 "updated_at": "updated_at",
13 "uuid": "uuid"
14 }
15 ],
16 "metadata": {
17 "metadata": {
18 "key": "value"
19 }
20 },
21 "relevant_summaries": [
22 {
23 "content": "content",
24 "created_at": "created_at",
25 "related_message_uuids": [
26 "related_message_uuids"
27 ],
28 "token_count": 1,
29 "uuid": "uuid"
30 }
31 ],
32 "summary": {
33 "content": "content",
34 "created_at": "created_at",
35 "metadata": {
36 "metadata": {
37 "key": "value"
38 }
39 },
40 "related_message_uuids": [
41 "related_message_uuids"
42 ],
43 "token_count": 1,
44 "uuid": "uuid"
45 }
46}