Documentation
¶
Index ¶
- type AgentState
- func (s *AgentState) Clear()
- func (s *AgentState) GetHistory() []string
- func (s *AgentState) GetTask() string
- func (s *AgentState) GetVariable(key string) (interface{}, bool)
- func (s *AgentState) SetTask(task string)
- func (s *AgentState) SetVariable(key string, value interface{})
- func (s *AgentState) String() string
- type Document
- type InMemoryLongTermMemory
- func (m *InMemoryLongTermMemory) Clear(ctx context.Context) error
- func (m *InMemoryLongTermMemory) Delete(ctx context.Context, id string) error
- func (m *InMemoryLongTermMemory) DeleteByMetadata(ctx context.Context, key, value string) error
- func (m *InMemoryLongTermMemory) Search(ctx context.Context, query []float64, limit int) ([]Document, error)
- func (m *InMemoryLongTermMemory) Store(ctx context.Context, doc Document) error
- type LongTermMemory
- type Message
- type ShortTermMemory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentState ¶
type AgentState struct {
CurrentTask string
History []string
Variables map[string]interface{}
// contains filtered or unexported fields
}
AgentState represents the current state of an agent
func (*AgentState) GetHistory ¶
func (s *AgentState) GetHistory() []string
GetHistory returns the task history
func (*AgentState) GetVariable ¶
func (s *AgentState) GetVariable(key string) (interface{}, bool)
GetVariable gets a state variable
func (*AgentState) SetTask ¶
func (s *AgentState) SetTask(task string)
SetTask sets the current task
func (*AgentState) SetVariable ¶
func (s *AgentState) SetVariable(key string, value interface{})
SetVariable sets a state variable
func (*AgentState) String ¶
func (s *AgentState) String() string
String returns a string representation of the state
type Document ¶
type Document struct {
ID string
Content string
Embedding []float64
Metadata map[string]interface{}
}
Document represents a document stored in long-term memory
type InMemoryLongTermMemory ¶
type InMemoryLongTermMemory struct {
// contains filtered or unexported fields
}
InMemoryLongTermMemory is a simple in-memory implementation for testing
func NewInMemoryLongTermMemory ¶
func NewInMemoryLongTermMemory() *InMemoryLongTermMemory
NewInMemoryLongTermMemory creates a new in-memory long-term memory
func (*InMemoryLongTermMemory) Clear ¶
func (m *InMemoryLongTermMemory) Clear(ctx context.Context) error
Clear clears all documents
func (*InMemoryLongTermMemory) Delete ¶
func (m *InMemoryLongTermMemory) Delete(ctx context.Context, id string) error
Delete deletes a document
func (*InMemoryLongTermMemory) DeleteByMetadata ¶
func (m *InMemoryLongTermMemory) DeleteByMetadata(ctx context.Context, key, value string) error
DeleteByMetadata deletes documents matching a metadata key-value pair
type LongTermMemory ¶
type LongTermMemory interface {
// Store stores a document with its embedding
Store(ctx context.Context, doc Document) error
// Search searches for similar documents
Search(ctx context.Context, query []float64, limit int) ([]Document, error)
// Delete deletes a document by ID
Delete(ctx context.Context, id string) error
// DeleteByMetadata deletes documents matching a metadata key-value pair
DeleteByMetadata(ctx context.Context, key, value string) error
// Clear clears all documents
Clear(ctx context.Context) error
}
LongTermMemory manages persistent vector storage
type ShortTermMemory ¶
type ShortTermMemory struct {
// contains filtered or unexported fields
}
ShortTermMemory manages the current conversation context
func NewShortTermMemory ¶
func NewShortTermMemory(maxSize int) *ShortTermMemory
NewShortTermMemory creates a new short-term memory
func (*ShortTermMemory) Add ¶
func (m *ShortTermMemory) Add(role, content string)
Add adds a message to the memory
func (*ShortTermMemory) GetAll ¶
func (m *ShortTermMemory) GetAll() []Message
GetAll returns all messages in memory
func (*ShortTermMemory) GetLast ¶
func (m *ShortTermMemory) GetLast(n int) []Message
GetLast returns the last n messages
func (*ShortTermMemory) Size ¶
func (m *ShortTermMemory) Size() int
Size returns the current number of messages
func (*ShortTermMemory) String ¶
func (m *ShortTermMemory) String() string
String returns a string representation of the conversation