Documentation
¶
Overview ¶
Package memory defines conversation memory and provides a concurrent buffer implementation.
Index ¶
- type BufferMemory
- type Memory
- type SummaryMemory
- func (m *SummaryMemory) Add(message types.Message)
- func (m *SummaryMemory) Clear()
- func (m *SummaryMemory) Compact(summary string)
- func (m *SummaryMemory) Get(index int) (types.Message, bool)
- func (m *SummaryMemory) Len() int
- func (m *SummaryMemory) Recent(count int) []types.Message
- func (m *SummaryMemory) Restore(summary string, messages []types.Message)
- func (m *SummaryMemory) Snapshot() []types.Message
- func (m *SummaryMemory) Summary() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BufferMemory ¶
type BufferMemory struct {
// contains filtered or unexported fields
}
func NewBufferMemory ¶
func NewBufferMemory(capacity int) *BufferMemory
func (*BufferMemory) Add ¶
func (m *BufferMemory) Add(msg types.Message)
func (*BufferMemory) Clear ¶
func (m *BufferMemory) Clear()
func (*BufferMemory) Len ¶
func (m *BufferMemory) Len() int
func (*BufferMemory) Snapshot ¶
func (m *BufferMemory) Snapshot() []types.Message
type SummaryMemory ¶ added in v0.3.0
type SummaryMemory struct {
// contains filtered or unexported fields
}
SummaryMemory retains raw messages until the engine supplies a successful summary. It never silently discards history at its hard limit.
func NewSummaryMemory ¶ added in v0.3.0
func NewSummaryMemory(keepRecent int) *SummaryMemory
func (*SummaryMemory) Add ¶ added in v0.3.0
func (m *SummaryMemory) Add(message types.Message)
func (*SummaryMemory) Clear ¶ added in v0.3.0
func (m *SummaryMemory) Clear()
func (*SummaryMemory) Compact ¶ added in v0.3.0
func (m *SummaryMemory) Compact(summary string)
Compact installs a caller-produced summary only after it has succeeded and retains the configured recent raw messages.
func (*SummaryMemory) Get ¶ added in v0.3.0
func (m *SummaryMemory) Get(index int) (types.Message, bool)
func (*SummaryMemory) Len ¶ added in v0.3.0
func (m *SummaryMemory) Len() int
func (*SummaryMemory) Recent ¶ added in v0.3.0
func (m *SummaryMemory) Recent(count int) []types.Message
func (*SummaryMemory) Restore ¶ added in v0.3.0
func (m *SummaryMemory) Restore(summary string, messages []types.Message)
func (*SummaryMemory) Snapshot ¶ added in v0.3.0
func (m *SummaryMemory) Snapshot() []types.Message
func (*SummaryMemory) Summary ¶ added in v0.3.0
func (m *SummaryMemory) Summary() string
Click to show internal directories.
Click to hide internal directories.