Class Session
java.lang.Object
uno.anahata.ai.tools.spi.Session
A tool provider for managing chat sessions using Kryo serialization.
These tools allow the model to persist the current conversation history to the 'sessions' directory within the work directory and reload it later, enabling long-running or multi-stage tasks.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionLists all available saved chat sessions in the 'sessions' directory.static voidloadSession(String id) Loads a conversation history from a file in the 'sessions' directory.static StringsaveSession(String name) Saves the current conversation history to a file in the 'sessions' directory.
-
Constructor Details
-
Session
public Session()
-
-
Method Details
-
saveSession
Saves the current conversation history to a file in the 'sessions' directory.- Parameters:
name- The name of the session (used as the filename).- Returns:
- A success message.
- Throws:
IOException- if an I/O error occurs.
-
listSavedSessions
Lists all available saved chat sessions in the 'sessions' directory.- Returns:
- A list of session names.
- Throws:
IOException- if an I/O error occurs.
-
loadSession
Loads a conversation history from a file in the 'sessions' directory.- Parameters:
id- The name of the session to load.- Throws:
IOException- if the session file is not found or an error occurs.
-
