Documentation
¶
Index ¶
- type DaprVectorStore
- func (d *DaprVectorStore) Delete(ctx context.Context, id string) error
- func (d *DaprVectorStore) Search(ctx context.Context, queryEmbedding []float64, limit int, ...) ([]VectorSearchResult, error)
- func (d *DaprVectorStore) Store(ctx context.Context, id string, embedding []float64, ...) error
- func (d *DaprVectorStore) Update(ctx context.Context, id string, embedding []float64, ...) error
- type EmbeddingProvider
- type Episode
- type HybridMemory
- type Interaction
- type Memory
- func (m *Memory) Add(ctx context.Context, memType MemoryType, content string, ...) error
- func (m *Memory) AddEpisode(ctx context.Context, episode Episode) error
- func (m *Memory) Clear(memType MemoryType)
- func (m *Memory) GetContext(ctx context.Context, query string, maxTokens int) (string, error)
- func (m *Memory) GetEpisodes(ctx context.Context, filters map[string]interface{}) ([]Episode, error)
- func (m *Memory) LoadFromState(ctx context.Context) error
- func (m *Memory) Reflect(ctx context.Context) ([]string, error)
- func (m *Memory) Retrieve(ctx context.Context, query string, limit int) ([]MemoryEntry, error)
- func (m *Memory) SaveToState(ctx context.Context) error
- type MemoryCompression
- type MemoryEntry
- type MemoryPrioritization
- type MemoryType
- type RAGMemory
- type Reranker
- type SimpleReranker
- type SummarizerProvider
- type VectorEntry
- type VectorMemory
- type VectorSearchResult
- type VectorStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DaprVectorStore ¶
type DaprVectorStore struct {
// contains filtered or unexported fields
}
DaprVectorStore implements VectorStore using Dapr state store
func NewDaprVectorStore ¶
func NewDaprVectorStore(client dapr.Client, storeName, indexName string) *DaprVectorStore
NewDaprVectorStore creates a Dapr-backed vector store
func (*DaprVectorStore) Delete ¶
func (d *DaprVectorStore) Delete(ctx context.Context, id string) error
func (*DaprVectorStore) Search ¶
func (d *DaprVectorStore) Search(ctx context.Context, queryEmbedding []float64, limit int, filters map[string]interface{}) ([]VectorSearchResult, error)
type EmbeddingProvider ¶
EmbeddingProvider generates embeddings
type Episode ¶
type Episode struct {
ID string `json:"id"`
Summary string `json:"summary"`
Interactions []Interaction `json:"interactions"`
Outcome string `json:"outcome"`
Lessons []string `json:"lessons"`
Metadata map[string]interface{} `json:"metadata"`
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
}
Episode represents an episodic memory
type HybridMemory ¶
type HybridMemory struct {
// contains filtered or unexported fields
}
HybridMemory combines multiple memory types for optimal retrieval
func NewHybridMemory ¶
func NewHybridMemory(shortTerm, episodic *Memory, rag *RAGMemory) *HybridMemory
NewHybridMemory creates a hybrid memory system
func (*HybridMemory) RetrieveHybrid ¶
RetrieveHybrid retrieves from all memory types and combines results
type Interaction ¶
type Interaction struct {
Role string `json:"role"`
Content string `json:"content"`
Timestamp time.Time `json:"timestamp"`
}
Interaction represents one turn in an episode
type Memory ¶
type Memory struct {
// contains filtered or unexported fields
}
Memory represents agent memory storage
func (*Memory) Add ¶
func (m *Memory) Add(ctx context.Context, memType MemoryType, content string, metadata map[string]interface{}) error
Add adds a memory entry
func (*Memory) AddEpisode ¶
AddEpisode records an episodic memory
func (*Memory) GetContext ¶
GetContext builds context from relevant memories
func (*Memory) GetEpisodes ¶
func (m *Memory) GetEpisodes(ctx context.Context, filters map[string]interface{}) ([]Episode, error)
GetEpisodes retrieves past episodes
func (*Memory) LoadFromState ¶
LoadFromState loads memory from Dapr state store
type MemoryCompression ¶
type MemoryCompression struct {
// contains filtered or unexported fields
}
MemoryCompression compresses old memories to save space
func (*MemoryCompression) CompressMemories ¶
func (m *MemoryCompression) CompressMemories(ctx context.Context, memories []MemoryEntry) ([]MemoryEntry, error)
CompressMemories compresses old memories into summaries
type MemoryEntry ¶
type MemoryEntry struct {
ID string `json:"id"`
Type MemoryType `json:"type"`
Content string `json:"content"`
Embedding []float64 `json:"embedding,omitempty"`
Metadata map[string]interface{} `json:"metadata"`
Timestamp time.Time `json:"timestamp"`
Importance float64 `json:"importance"` // 0-1 scale
}
MemoryEntry represents a single memory
type MemoryPrioritization ¶
type MemoryPrioritization struct {
// contains filtered or unexported fields
}
MemoryPrioritization prioritizes memories based on multiple factors
func (*MemoryPrioritization) PriorityScore ¶
func (m *MemoryPrioritization) PriorityScore(entry *MemoryEntry, accessCount int) float64
PriorityScore calculates priority score for a memory
func (*MemoryPrioritization) PruneMemories ¶
func (m *MemoryPrioritization) PruneMemories(entries []MemoryEntry, accessCounts map[string]int, keepCount int) []MemoryEntry
PruneMemories removes low-priority memories
type MemoryType ¶
type MemoryType string
MemoryType defines different memory types
const ( ShortTerm MemoryType = "short-term" // Recent conversation LongTerm MemoryType = "long-term" // Persistent facts Episodic MemoryType = "episodic" // Past episodes/experiences Semantic MemoryType = "semantic" // General knowledge Procedural MemoryType = "procedural" // How-to knowledge )
type RAGMemory ¶
type RAGMemory struct {
// contains filtered or unexported fields
}
RAGMemory implements Retrieval-Augmented Generation memory
func NewRAGMemory ¶
func NewRAGMemory(base *Memory, vectorStore VectorStore, embedder EmbeddingProvider) *RAGMemory
NewRAGMemory creates a new RAG-enabled memory system
type Reranker ¶
type Reranker interface {
Rerank(ctx context.Context, query string, results []VectorSearchResult) ([]VectorSearchResult, error)
}
Reranker reorders search results for better relevance
type SimpleReranker ¶
type SimpleReranker struct {
// contains filtered or unexported fields
}
SimpleReranker implements cross-encoder style reranking
func NewSimpleReranker ¶
func NewSimpleReranker(embedder EmbeddingProvider) *SimpleReranker
func (*SimpleReranker) Rerank ¶
func (s *SimpleReranker) Rerank(ctx context.Context, query string, results []VectorSearchResult) ([]VectorSearchResult, error)
type SummarizerProvider ¶
type SummarizerProvider interface {
Summarize(ctx context.Context, content string) (string, error)
}
SummarizerProvider generates summaries of content
type VectorEntry ¶
type VectorEntry struct {
ID string
Embedding []float64
Metadata map[string]interface{}
Timestamp time.Time
}
VectorEntry represents a stored vector
type VectorMemory ¶
type VectorMemory struct {
// contains filtered or unexported fields
}
VectorMemory provides vector-based semantic memory
func NewVectorMemory ¶
func NewVectorMemory(base *Memory, embedder EmbeddingProvider) *VectorMemory
NewVectorMemory creates vector-enabled memory
func (*VectorMemory) AddWithEmbedding ¶
func (v *VectorMemory) AddWithEmbedding(ctx context.Context, memType MemoryType, content string, metadata map[string]interface{}) error
AddWithEmbedding adds memory with vector embedding
func (*VectorMemory) SemanticSearch ¶
func (v *VectorMemory) SemanticSearch(ctx context.Context, query string, limit int) ([]MemoryEntry, error)
SemanticSearch performs vector similarity search
type VectorSearchResult ¶
type VectorSearchResult struct {
ID string
Score float64
Embedding []float64
Metadata map[string]interface{}
Content string
}
VectorSearchResult represents a search result from vector store
type VectorStore ¶
type VectorStore interface {
Store(ctx context.Context, id string, embedding []float64, metadata map[string]interface{}) error
Search(ctx context.Context, queryEmbedding []float64, limit int, filters map[string]interface{}) ([]VectorSearchResult, error)
Delete(ctx context.Context, id string) error
Update(ctx context.Context, id string, embedding []float64, metadata map[string]interface{}) error
}
VectorStore interface for vector database operations