Documentation
¶
Overview ¶
Package session stores bounded conversation history in SQLite.
Index ¶
- Constants
- func EstTokens(msgs []Message) int
- type LLMSummarizer
- type Message
- type Store
- func (s *Store) Append(ctx context.Context, sessionID string, msgs ...Message) error
- func (s *Store) Close() error
- func (s *Store) DB() *sql.DB
- func (s *Store) Messages(ctx context.Context, sessionID string) ([]Message, error)
- func (s *Store) Reset(ctx context.Context, sessionID string) error
- func (s *Store) Stats(ctx context.Context, sessionID string) (messages int, estTokens int, err error)
- func (s *Store) Summary(ctx context.Context, sessionID string) (string, error)
- func (s *Store) WithSummarizer(sum Summarizer) *Store
- type Summarizer
Constants ¶
View Source
const ( RoleUser = "user" RoleAssistant = "assistant" )
Role values persisted for conversation turns (system/persona is not stored).
Variables ¶
This section is empty.
Functions ¶
Types ¶
type LLMSummarizer ¶
LLMSummarizer uses the chat completer for a cheap compression pass.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a SQLite-backed session history.
func (*Store) Stats ¶
func (s *Store) Stats(ctx context.Context, sessionID string) (messages int, estTokens int, err error)
Stats returns message count and estimated tokens (chars/4) for a session.
func (*Store) WithSummarizer ¶
func (s *Store) WithSummarizer(sum Summarizer) *Store
WithSummarizer enables rolling summary when history is trimmed.
Click to show internal directories.
Click to hide internal directories.