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 disk 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.
      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.
      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 saved session file.
      Parameters:
      id - The name of the session to load.
      Throws:
      IOException - if the session file is not found or an error occurs.