memory

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithCompactThreshold

func WithCompactThreshold(n int) memoryConfigFunc

Trigger memory compaction when the number of conversations is greater than or equal to n.

Remove the earliest n / 2 conversations (CompactCount), summarize them, and merge them to long term memory.

func WithLongTermMemoryTTL

func WithLongTermMemoryTTL(v time.Duration) memoryConfigFunc

Set long term memory TTL to v.

func WithShortTermMemoryTTL

func WithShortTermMemoryTTL(v time.Duration) memoryConfigFunc

Set short term memory TTL to v.

Types

type Conversation

type Conversation struct {
	Time      atom.Time `json:"time"`
	User      string    `json:"user"`
	Assistant string    `json:"assistant"`
}

type TempMemory

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

func NewTempMemory

func NewTempMemory(key string, agent *agents.MemorySummarizer, ops ...memoryConfigFunc) *TempMemory

Create TempMemory.

By default, CompactThreshold is set to 4, CompactCount is set to 2, and both the long term memory and short term memory are set to 30 days.

func (*TempMemory) Append

func (m *TempMemory) Append(rail miso.Rail, c Conversation) error

func (*TempMemory) Load

func (m *TempMemory) Load(rail miso.Rail) (_longTerm string, shortTerm []Conversation, _err error)

func (*TempMemory) LoadFormatted

func (m *TempMemory) LoadFormatted(rail miso.Rail, lock bool) (_longTerm string, _shortTerm string, _err error)

func (*TempMemory) LoadLocked

func (m *TempMemory) LoadLocked(rail miso.Rail) (_longTerm string, shortTerm []Conversation, _err error)

Jump to

Keyboard shortcuts

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