Documentation
¶
Overview ¶
FAISS disabled stub
Unified Vector Memory Store - FAISS HNSW + SQLite + Local/OpenAI Embeddings
Index ¶
- Variables
- func DetectCategory(text string) string
- func FAISSVersion() string
- func IsFAISSAvailable() bool
- type Config
- type EmbeddingProvider
- type HNSWConfig
- type HNSWIndex
- func (idx *HNSWIndex) Add(vectors [][]float32) error
- func (idx *HNSWIndex) Close() error
- func (idx *HNSWIndex) Config() HNSWConfig
- func (idx *HNSWIndex) Count() int64
- func (idx *HNSWIndex) Dim() int
- func (idx *HNSWIndex) Load(path string) error
- func (idx *HNSWIndex) Loaded() bool
- func (idx *HNSWIndex) Metric() string
- func (idx *HNSWIndex) Save(path string) error
- func (idx *HNSWIndex) Search(query []float32, k int) ([]float32, []int64, error)
- func (idx *HNSWIndex) SearchWithScores(query []float32, k int) ([]float32, []int64, error)
- type LocalProvider
- type MemoryEntry
- type MemoryResult
- type OpenAIProvider
- type VectorMemoryStore
- func (s *VectorMemoryStore) Close() error
- func (s *VectorMemoryStore) Count() (int, error)
- func (s *VectorMemoryStore) Delete(id string) (bool, error)
- func (s *VectorMemoryStore) Get(id string) (MemoryEntry, error)
- func (s *VectorMemoryStore) Search(query string, limit int, minScore float32) ([]MemoryResult, error)
- func (s *VectorMemoryStore) Store(text string, category string, importance float64) (string, error)
- func (s *VectorMemoryStore) StoreWithSource(text string, category string, importance float64, source string) (string, error)
- func (s *VectorMemoryStore) Update(id string, text string, category string, importance float64) (bool, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var EMBEDDING_DIMENSIONS = map[string]int{
"text-embedding-3-small": 1536,
"text-embedding-3-large": 3072,
"text-embedding-ada-002": 1024,
}
Model dimension
View Source
var MEMORY_CATEGORIES = []string{"preference", "decision", "fact", "entity", "other"}
Categories compatible with OpenClaw
Functions ¶
func FAISSVersion ¶
func FAISSVersion() string
func IsFAISSAvailable ¶
func IsFAISSAvailable() bool
Types ¶
type Config ¶
type Config struct {
ApiKey string // OpenAI API Key (or ${OPENAI_API_KEY})
EmbeddingModel string // OpenAI model: text-embedding-3-small/large
EmbeddingServer string // Local embedding service URL
EmbeddingDim int // Embedding dimension (auto-detected)
MaxResults int // Max results (default 5)
MinScore float32 // Minimum similarity score (default 0.7)
HNSWPath string // HNSW index file path
HybridEnabled bool // Enable hybrid search (default true)
VectorWeight float32 // Vector weight (default 0.7)
TextWeight float32 // Keyword weight (default 0.3)
CandidateMult int // Candidate multiplier (default 4)
}
Config
type EmbeddingProvider ¶
Embedding provider interface
type HNSWConfig ¶
type HNSWConfig struct {
Dim int
M int
EfSearch int
EfConstruct int
Distance string
StoragePath string
}
HNSW index config (kept in sync with the FAISS build)
type HNSWIndex ¶
type HNSWIndex struct {
// contains filtered or unexported fields
}
HNSWIndex placeholder when FAISS build tag is missing. Used to compile and automatically fall back to SQLite search. Note: all methods return unavailable or empty results.
func NewHNSWIndex ¶
func NewHNSWIndex(cfg HNSWConfig) (*HNSWIndex, error)
func (*HNSWIndex) Config ¶
func (idx *HNSWIndex) Config() HNSWConfig
type LocalProvider ¶
type LocalProvider struct {
// contains filtered or unexported fields
}
Local embedding (llama.cpp server)
func NewLocalProvider ¶
func NewLocalProvider(serverURL string, dim int) (*LocalProvider, error)
func (*LocalProvider) Dim ¶
func (p *LocalProvider) Dim() int
func (*LocalProvider) Name ¶
func (p *LocalProvider) Name() string
type MemoryEntry ¶
type MemoryEntry struct {
ID string
Text string
Vector []float32
Importance float64
Category string
Source string
CreatedAt int64
UpdatedAt int64
}
Memory entry
type MemoryResult ¶
type MemoryResult struct {
Entry MemoryEntry
Score float32 // Similarity score (0-1)
Matched bool // Whether matched
}
Search result (with similarity score)
type OpenAIProvider ¶
type OpenAIProvider struct {
// contains filtered or unexported fields
}
OpenAI embedding
func NewOpenAIProvider ¶
func NewOpenAIProvider(apiKey, model string) (*OpenAIProvider, error)
func (*OpenAIProvider) Dim ¶
func (p *OpenAIProvider) Dim() int
func (*OpenAIProvider) Name ¶
func (p *OpenAIProvider) Name() string
type VectorMemoryStore ¶
type VectorMemoryStore struct {
// contains filtered or unexported fields
}
Vector memory store - unified architecture
func NewVectorMemoryStore ¶
func NewVectorMemoryStore(dbPath string, cfg Config) (*VectorMemoryStore, error)
func (*VectorMemoryStore) Close ¶
func (s *VectorMemoryStore) Close() error
func (*VectorMemoryStore) Count ¶
func (s *VectorMemoryStore) Count() (int, error)
func (*VectorMemoryStore) Get ¶
func (s *VectorMemoryStore) Get(id string) (MemoryEntry, error)
Get memory entry (exposed to tools)
func (*VectorMemoryStore) Search ¶
func (s *VectorMemoryStore) Search(query string, limit int, minScore float32) ([]MemoryResult, error)
Search - with similarity scores
func (*VectorMemoryStore) StoreWithSource ¶
Click to show internal directories.
Click to hide internal directories.