Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddRequest ¶
type AddRequest struct {
AgentID string
Content string
Metadata map[string]any
Embed bool // whether to generate embedding
}
AddRequest is the request to add a memory.
type Backend ¶
type Backend interface {
MemoryStore
Initialize(ctx context.Context, config *BackendConfig) error
Close() error
Health() error
}
Backend is a MemoryStore with lifecycle management.
type BackendConfig ¶
type BackendConfig struct {
Type string `json:"type"` // sqlite, postgres, mem0, chroma
DSN string `json:"dsn,omitempty"`
Options map[string]any `json:"options,omitempty"`
}
BackendConfig configures a memory backend.
type ListOptions ¶
ListOptions configures a memory list operation.
type Memory ¶
type Memory struct {
ID string
AgentID string
Content string
Embedding []float64
Metadata map[string]any
CreatedAt time.Time
UpdatedAt time.Time
Score float64 // relevance score for search results
}
Memory represents a single memory entry.
type MemoryStore ¶
type MemoryStore interface {
Add(ctx context.Context, req *AddRequest) (*Memory, error)
Get(ctx context.Context, id string) (*Memory, error)
Update(ctx context.Context, id string, req *UpdateRequest) error
Delete(ctx context.Context, id string) error
Search(ctx context.Context, query string, opts *SearchOptions) ([]*Memory, error)
SearchSimilar(ctx context.Context, embedding []float64, opts *SearchOptions) ([]*Memory, error)
ListByAgent(ctx context.Context, agentID string, opts *ListOptions) ([]*Memory, error)
ClearAgentMemory(ctx context.Context, agentID string) error
BatchAdd(ctx context.Context, reqs []*AddRequest) ([]*Memory, error)
}
MemoryStore defines the interface for agent memory.
type SearchOptions ¶
SearchOptions configures a memory search.
type SearchResult ¶
SearchResult is a result from a vector similarity search.
type UpdateRequest ¶
UpdateRequest is the request to update a memory.
type VectorStore ¶
type VectorStore interface {
Insert(ctx context.Context, id string, embedding []float64, metadata map[string]any) error
Search(ctx context.Context, embedding []float64, k int) ([]*SearchResult, error)
Delete(ctx context.Context, id string) error
}
VectorStore handles vector operations for similarity search.
Click to show internal directories.
Click to hide internal directories.