Versions in this module Expand all Collapse all v1 v1.1.0 Jun 15, 2026 Changes in this version + func SplitText(text string, chunkSize, chunkOverlap int) []string + type CombinedWeights struct + KeywordWeight float64 + TimeWeight float64 + VectorWeight float64 + func DefaultCombinedWeights() *CombinedWeights + type Config struct + ChunkOverlap int + ChunkSize int + CombinedCandidateMult int + CombinedWeights *CombinedWeights + ConnMaxLifetime time.Duration + DBPath string + DefaultTopK int + DisableVectorSearch bool + EmbeddingDimension int + HNSW_EfSearch int + HNSW_M int + HNSW_Ml float64 + HybridKeywordWeight float64 + HybridTimeWeight float64 + IndexCachePath string + IndexRebuildBatchSize int + LogLevel logger.LogLevel + MaxIdleConns int + MaxOpenConns int + RecallMode RecallMode + TimeDecayHalfLifeMs float64 + func DefaultConfig() *Config + type DocumentModel struct + Collection string + Content string + CreatedAt time.Time + Embedding string + ID string + MetaData string + Timestamp int64 + func (m *DocumentModel) GetEmbedding() []float32 + func (m *DocumentModel) TableName() string + func (m *DocumentModel) ToDocument() *schema.Document + type EmbeddingChunk struct + ChunkIndex int + Content string + Embedding string + ID string + MessageID string + SessionID string + func (c *EmbeddingChunk) GetEmbedding() ([]float32, error) + func (c *EmbeddingChunk) SetEmbedding(vec []float32) error + func (c *EmbeddingChunk) TableName() string + type EmbeddingFunc func(ctx context.Context, text string) ([]float32, error) + type GORMDocStore struct + func NewGORMDocStore(store *GORMStore) *GORMDocStore + func (d *GORMDocStore) Close() error + func (d *GORMDocStore) DeleteCollection(ctx context.Context, collection string) error + func (d *GORMDocStore) GetDocuments(ctx context.Context, collection string) ([]*schema.Document, error) + func (d *GORMDocStore) RecallDocuments(ctx context.Context, collection string, query string, topK int) ([]*schema.Document, error) + func (d *GORMDocStore) SaveDocuments(ctx context.Context, collection string, docs []*schema.Document) error + type GORMStore struct + func NewGORMStore(config *Config, embedding EmbeddingFunc) (*GORMStore, error) + func (s *GORMStore) ClearSession(ctx context.Context, sessionID string) error + func (s *GORMStore) Close() error + func (s *GORMStore) GetDB() *gorm.DB + func (s *GORMStore) GetSession(ctx context.Context, sessionID string) ([]*schema.Message, error) + func (s *GORMStore) GetSessionStats(ctx context.Context, sessionID string) (map[string]any, error) + func (s *GORMStore) GetSessionWithReasoning(ctx context.Context, sessionID string) ([]*schema.Message, error) + func (s *GORMStore) Save(ctx context.Context, sessionID string, msgs []*schema.Message) error + func (s *GORMStore) SearchByRole(ctx context.Context, sessionID string, role schema.RoleType, limit int) ([]*schema.Message, error) + func (s *GORMStore) SearchByTimeRange(ctx context.Context, sessionID string, start, end time.Time) ([]*schema.Message, error) + type HNSWRetriever struct + func NewHNSWRetriever(db *gorm.DB, embedding EmbeddingFunc, config *Config) *HNSWRetriever + func (r *HNSWRetriever) AddToIndex(ctx context.Context, sessionID string, msgs []*schema.Message) error + func (r *HNSWRetriever) Close() error + func (r *HNSWRetriever) IndexReady() bool + func (r *HNSWRetriever) RebuildIndex() + func (r *HNSWRetriever) Recall(ctx context.Context, sessionID string, query string, topK int) ([]*schema.Message, error) + func (r *HNSWRetriever) RemoveFromIndex(sessionID string) error + type MessageModel struct + Content string + CreatedAt time.Time + Embedding string + ID string + Metadata string + ReasoningContent string + Role string + SessionID string + Timestamp int64 + func (m *MessageModel) GetEmbedding() ([]float32, error) + func (m *MessageModel) SetEmbedding(vec []float32) error + func (m *MessageModel) TableName() string + func (m *MessageModel) ToSchemaMessage() *schema.Message + type RecallMode int + const RecallModeAuto + const RecallModeCombined + const RecallModeHybrid + const RecallModeVector