Class Session

java.lang.Object
uno.anahata.ai.tools.spi.Session

public class Session extends Object
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 Details

    • Session

      public Session()
  • Method Details

    • saveSession

      public static String saveSession(String name) throws IOException
      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

      public static List<String> listSavedSessions() throws IOException
      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

      public static void loadSession(String id) throws IOException
      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.