Documentation ¶
Overview ¶
Package memory contains implementations for managing conversation data and facilitating the persistence of state between chain or agent calls.
Index ¶
- type Combined
- func (m *Combined) Clear(ctx context.Context) error
- func (m *Combined) LoadMemoryVariables(ctx context.Context, inputs map[string]any) (map[string]any, error)
- func (m *Combined) MemoryKeys() []string
- func (m *Combined) SaveContext(ctx context.Context, inputs map[string]any, outputs map[string]any) error
- type ConversationBuffer
- func (m *ConversationBuffer) Clear(ctx context.Context) error
- func (m *ConversationBuffer) LoadMemoryVariables(ctx context.Context, inputs map[string]any) (map[string]any, error)
- func (m *ConversationBuffer) MemoryKeys() []string
- func (m *ConversationBuffer) SaveContext(ctx context.Context, inputs map[string]any, outputs map[string]any) error
- type ConversationBufferOptions
- type ConversationTokenBuffer
- func (m *ConversationTokenBuffer) Clear(ctx context.Context) error
- func (m *ConversationTokenBuffer) LoadMemoryVariables(ctx context.Context, inputs map[string]any) (map[string]any, error)
- func (m *ConversationTokenBuffer) MemoryKeys() []string
- func (m *ConversationTokenBuffer) SaveContext(ctx context.Context, inputs map[string]any, outputs map[string]any) error
- type ConversationTokenBufferOptions
- type Readonly
- func (m *Readonly) Clear(ctx context.Context) error
- func (m *Readonly) LoadMemoryVariables(ctx context.Context, inputs map[string]any) (map[string]any, error)
- func (m *Readonly) MemoryKeys() []string
- func (m *Readonly) SaveContext(ctx context.Context, inputs map[string]any, outputs map[string]any) error
- type Simple
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Combined ¶ added in v0.0.5
type Combined struct {
// contains filtered or unexported fields
}
func (*Combined) LoadMemoryVariables ¶ added in v0.0.5
func (*Combined) MemoryKeys ¶ added in v0.0.21
type ConversationBuffer ¶ added in v0.0.6
type ConversationBuffer struct {
// contains filtered or unexported fields
}
ConversationBuffer is a memory type that manages conversation buffers.
func NewConversationBuffer ¶ added in v0.0.6
func NewConversationBuffer(optFns ...func(o *ConversationBufferOptions)) *ConversationBuffer
NewConversationBuffer creates a new instance of ConversationBuffer memory type.
func (*ConversationBuffer) Clear ¶ added in v0.0.6
func (m *ConversationBuffer) Clear(ctx context.Context) error
Clear clears the chat message history.
func (*ConversationBuffer) LoadMemoryVariables ¶ added in v0.0.6
func (m *ConversationBuffer) LoadMemoryVariables(ctx context.Context, inputs map[string]any) (map[string]any, error)
LoadMemoryVariables returns key-value pairs given the text input to the chain.
func (*ConversationBuffer) MemoryKeys ¶ added in v0.0.21
func (m *ConversationBuffer) MemoryKeys() []string
MemoryKeys returns the memory keys for ConversationBuffer.
func (*ConversationBuffer) SaveContext ¶ added in v0.0.6
func (m *ConversationBuffer) SaveContext(ctx context.Context, inputs map[string]any, outputs map[string]any) error
SaveContext saves the input and output messages to the chat message history.
type ConversationBufferOptions ¶ added in v0.0.6
type ConversationBufferOptions struct { HumanPrefix string AIPrefix string MemoryKey string InputKey string OutputKey string ReturnMessages bool ChatMessageHistory schema.ChatMessageHistory // Size of the interactions window K uint }
ConversationBufferOptions contains options for configuring the ConversationBuffer memory type.
type ConversationTokenBuffer ¶ added in v0.0.89
type ConversationTokenBuffer struct {
// contains filtered or unexported fields
}
ConversationTokenBuffer is a memory type that manages conversation token buffers.
func NewConversationTokenBuffer ¶ added in v0.0.89
func NewConversationTokenBuffer(tokenizer schema.Tokenizer, optFns ...func(o *ConversationTokenBufferOptions)) *ConversationTokenBuffer
NewConversationTokenBuffer creates a new instance of ConversationTokenBuffer memory type.
func (*ConversationTokenBuffer) Clear ¶ added in v0.0.89
func (m *ConversationTokenBuffer) Clear(ctx context.Context) error
Clear clears the chat message history.
func (*ConversationTokenBuffer) LoadMemoryVariables ¶ added in v0.0.89
func (m *ConversationTokenBuffer) LoadMemoryVariables(ctx context.Context, inputs map[string]any) (map[string]any, error)
LoadMemoryVariables returns key-value pairs given the text input to the chain.
func (*ConversationTokenBuffer) MemoryKeys ¶ added in v0.0.89
func (m *ConversationTokenBuffer) MemoryKeys() []string
MemoryKeys returns the memory keys for ConversationTokenBuffer.
func (*ConversationTokenBuffer) SaveContext ¶ added in v0.0.89
func (m *ConversationTokenBuffer) SaveContext(ctx context.Context, inputs map[string]any, outputs map[string]any) error
SaveContext saves the input and output messages to the chat message history.
type ConversationTokenBufferOptions ¶ added in v0.0.89
type ConversationTokenBufferOptions struct { HumanPrefix string AIPrefix string MemoryKey string InputKey string OutputKey string ReturnMessages bool ChatMessageHistory schema.ChatMessageHistory MaxTokenLimit uint }
ConversationTokenBufferOptions contains options for configuring the ConversationTokenBuffer memory type.
type Readonly ¶ added in v0.0.5
type Readonly struct {
// contains filtered or unexported fields
}
func NewReadonly ¶ added in v0.0.5
func (*Readonly) LoadMemoryVariables ¶ added in v0.0.5
func (*Readonly) MemoryKeys ¶ added in v0.0.21
type Simple ¶
type Simple struct {
// contains filtered or unexported fields
}