org.llm4s.assistant
Members list
Type members
Classlikes
Interactive assistant agent that wraps an org.llm4s.agent.Agent in a user-friendly conversational loop with session management. The agent is built once, from client and tools; each query is one turn on the session's thread.
Interactive assistant agent that wraps an org.llm4s.agent.Agent in a user-friendly conversational loop with session management. The agent is built once, from client and tools; each query is one turn on the session's thread.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
Information about a saved session file.
Information about a saved session file.
Contains metadata about a persisted session including file location and statistics about the conversation.
Value parameters
- created
-
Timestamp when the session was created
- filePath
-
Path to the session JSON file
- fileSize
-
Size of the session file in bytes
- id
-
Unique session identifier
- messageCount
-
Number of messages in the conversation
- title
-
Human-readable session title
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
SessionInfo.type
Manages session persistence for the interactive assistant.
Manages session persistence for the interactive assistant.
SessionManager handles saving and loading conversation sessions to disk, enabling users to resume previous conversations and maintain context across multiple interactions.
== Key Features ==
- '''Session Save''': Persists the conversation's messages as JSON with markdown companion
- '''Session Load''': Restores the messages, which the next turn imports into a new agent thread
- '''Session Listing''': Shows recent sessions sorted by modification time
- '''Filename Sanitization''': Safely handles special characters in titles
== Storage Format == Sessions are stored as two files:
{title}.json- Machine-readable session state for loading{title}.md- Human-readable markdown for viewing/sharing
== Usage Example ==
val manager = new SessionManager(DirectoryPath("/path/to/sessions"))
// Save current session
val info = manager.saveSession(sessionState, Some("My Conversation"))
// List recent sessions
val sessions = manager.listRecentSessions(limit = 5)
// Load a previous session
val loaded = manager.loadSession("My Conversation")
Value parameters
- sessionDir
-
Directory path where sessions are stored
- uniqueSuffix
-
Generator for the suffix used to disambiguate filename collisions; injectable for testing
Attributes
- See also
-
SessionState for the state being persisted
SessionInfo for session metadata returned after save
- Supertypes
-
class Objecttrait Matchableclass Any
Represents the state of an interactive assistant session.
Represents the state of an interactive assistant session.
The conversation lives on a thread of the assistant's agent: threadId names it once a turn has run, and last is that turn's result. A loaded session has neither yet: its saved messages are in history, and the next turn imports them into a new thread.
Value parameters
- created
-
Timestamp when the session was created
- history
-
Messages loaded from a saved session, imported by the next turn
- last
-
The result of the latest turn on
threadId - sessionDir
-
Directory path for session file storage
- sessionId
-
Unique identifier for this session
- threadId
-
The agent thread holding the conversation, once a turn has run on it
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
SessionState.type
Summary of a session for listing and display purposes.
Summary of a session for listing and display purposes.
Lightweight representation of a session containing only essential information for session selection UI.
Value parameters
- created
-
Timestamp when the session was created
- filename
-
Base filename of the session file
- id
-
Unique session identifier
- title
-
Human-readable session title
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
SessionSummary.type