Sessions
Sessions represent a conversation. Each User can have multiple sessions, and each session is a sequence of chat messages.
Chat messages are added to sessions using memory.add
, which both adds those messages to the session history and ingests those messages into the user-level knowledge graph. The user knowledge graph contains data from all of that user’s sessions to create an integrated understanding of the user.
The knowledge graph does not separate the data from different sessions, but integrates the data together to create a unified picture of the user. So the get session memory endpoint and the associated memory.get
method don’t return memory derived only from that session, but instead return whatever user-level memory is most relevant to that session, based on the session’s most recent messages.
Adding a Session
SessionIDs
are arbitrary identifiers that you can map to relevant business objects in your app, such as users or a
conversation a user might have with your app. Before you create a session, make sure you have created a user first. Then create a session with:
Python
TypeScript
Getting a Session
Python
TypeScript
Deleting a Session
Deleting a session deletes it and its associated messages. It does not however delete the associated data in the user’s knowledge graph. To remove data from the graph, see deleting data from the graph.
Python
TypeScript
Listing Sessions
You can list all Sessions in the Zep Memory Store with page_size and page_number parameters for pagination.