memory

package
v1.8.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	MaxHistoryMessages      int
	EnableMemoryCompress    bool
	MemoryCompressThreshold int
	KeepRecentCount         int
	CompressionRatio        float32
	PersistDirectory        string
}

func DefaultConfig

func DefaultConfig() *Config

type ConversationSummary

type ConversationSummary struct {
	// contains filtered or unexported fields
}

func NewConversationSummary

func NewConversationSummary() *ConversationSummary

func (*ConversationSummary) AddMessage

func (s *ConversationSummary) AddMessage(msg Message)

func (*ConversationSummary) GetLastUpdated

func (s *ConversationSummary) GetLastUpdated() time.Time

func (*ConversationSummary) GetMessageCount

func (s *ConversationSummary) GetMessageCount() int

func (*ConversationSummary) GetSummary

func (s *ConversationSummary) GetSummary() string

func (*ConversationSummary) SetSummary

func (s *ConversationSummary) SetSummary(summary string)

type Hybrid

type Hybrid struct {
	// contains filtered or unexported fields
}

func NewHybrid

func NewHybrid(sessionID string, provider Provider, llmProvider LLMProvider, config *Config) *Hybrid

func (*Hybrid) AddMessage

func (m *Hybrid) AddMessage(ctx context.Context, msg Message) error

func (*Hybrid) Clear

func (m *Hybrid) Clear(ctx context.Context) error

func (*Hybrid) Compress

func (m *Hybrid) Compress(ctx context.Context) error

func (*Hybrid) GetMessages

func (m *Hybrid) GetMessages(ctx context.Context, limit int) ([]Message, error)

func (*Hybrid) GetStats

func (m *Hybrid) GetStats() Stats

func (*Hybrid) GetSummary

func (m *Hybrid) GetSummary(ctx context.Context) (string, error)

type InMemory

type InMemory struct {
	*agentproviders.SimpleMemoryProvider
	// contains filtered or unexported fields
}

func (*InMemory) AddMessage

func (m *InMemory) AddMessage(ctx context.Context, msg Message) error

func (*InMemory) Clear

func (m *InMemory) Clear(ctx context.Context) error

func (*InMemory) Compress

func (m *InMemory) Compress(ctx context.Context) error

func (*InMemory) GetMessages

func (m *InMemory) GetMessages(ctx context.Context, limit int) ([]Message, error)

func (*InMemory) GetStats

func (m *InMemory) GetStats() Stats

func (*InMemory) GetSummary

func (m *InMemory) GetSummary(ctx context.Context) (string, error)

type LLMProvider

type LLMProvider interface {
	GenerateSummary(ctx context.Context, messages []Message) (string, error)
}

type Message

type Message = agenttypes.Message

type Provider

type Provider interface {
	AddMessage(ctx context.Context, msg Message) error
	GetMessages(ctx context.Context, limit int) ([]Message, error)
	GetSummary(ctx context.Context) (string, error)
	Compress(ctx context.Context) error
	Clear(ctx context.Context) error
	GetStats() Stats
}

func NewInMemory

func NewInMemory(sessionID string, config *Config) Provider

func NewSQLite

func NewSQLite(sessionID string, config *Config) (Provider, error)

type SQLite

type SQLite struct {
	// contains filtered or unexported fields
}

func (*SQLite) AddMessage

func (s *SQLite) AddMessage(ctx context.Context, msg Message) error

func (*SQLite) Clear

func (s *SQLite) Clear(ctx context.Context) error

func (*SQLite) Close

func (s *SQLite) Close() error

func (*SQLite) Compress

func (s *SQLite) Compress(ctx context.Context) error

func (*SQLite) GetMessages

func (s *SQLite) GetMessages(ctx context.Context, limit int) ([]Message, error)

func (*SQLite) GetStats

func (s *SQLite) GetStats() Stats

func (*SQLite) GetSummary

func (s *SQLite) GetSummary(ctx context.Context) (string, error)

type Stats

type Stats struct {
	MessageCount  int `json:"message_count"`
	SummaryLength int `json:"summary_length"`
	TotalTokens   int `json:"total_tokens"`
}

type ToolCall

type ToolCall struct {
	Name   string `json:"name"`
	Input  string `json:"input"`
	Result string `json:"result"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL