class documentation
Class for managing an agent session, including conversation history and session ID.
| Class Method | delete |
Deletes the session with the specified ID from the storage backend. |
| Class Method | delete |
Deletes the session at the specified index from the storage backend. |
| Class Method | exists |
Checks if a session with the given ID exists in the storage backend. |
| Class Method | get |
Retrieves the conversation history for the specified session ID from the storage backend. |
| Class Method | ls |
Returns a list of all session IDs stored in the storage backend. |
| Method | __del__ |
Cleans up the session before it is destroyed. |
| Method | __init__ |
Initializes a new session with the given storage backend and optional session ID. |
| Method | append |
Appends a message to the session's conversation history and saves it to the storage backend. |
| Method | append |
Append multiple messages and save the session once. |
| Method | list |
Returns a list of all session IDs stored in the storage backend. |
| Method | update |
Updates the session's conversation history and saves it to the storage backend. |
| Class Variable | __slots__ |
Undocumented |
| Instance Variable | conversation |
The conversation history for the session. |
| Property | id |
Returns the unique session ID. |
| Property | path |
Returns the storage path for the session JSON file. |
| Method | _load |
Loads a session from the storage backend using the provided session ID. |
| Method | _save |
Saves the current session to the storage backend. |
| Instance Variable | _id |
Undocumented |
| Instance Variable | _storage |
Undocumented |
| Instance Variable | _time |
Undocumented |
Initializes a new session with the given storage backend and optional session ID.
| Parameters | |
| view | An instance of the view manager containing the storage backend for saving and loading session data. |
sessionstr, optional | The unique identifier for the session. If not provided, a new session ID will be generated. |
| Raises | |
Exception | If the session cannot be loaded from storage with the provided session ID. |