Documentation
¶
Index ¶
- Constants
- Variables
- func CheckCompatible(db *sql.DB) error
- func IsDatabaseNotFound(err error) bool
- func IsMigrationRequired(err error) bool
- func Migrate(db *sql.DB) error
- func Open(path string) (*sql.DB, error)
- func OpenExisting(path string) (*sql.DB, error)
- func OpenExistingWritable(path string) (*sql.DB, error)
- type EmbeddingIdentity
- type IndexHealth
- type Repository
- func (r *Repository) AddMemory(ctx context.Context, text string, embedding []float32, ...) (domain.Memory, error)
- func (r *Repository) CountMemories(ctx context.Context) (int64, error)
- func (r *Repository) EditMemory(ctx context.Context, id int64, text string, embedding []float32, ...) (domain.Memory, error)
- func (r *Repository) ForgetMemory(ctx context.Context, id int64) error
- func (r *Repository) GetMemory(ctx context.Context, id int64) (domain.Memory, error)
- func (r *Repository) IndexHealth(ctx context.Context, identity EmbeddingIdentity) (IndexHealth, error)
- func (r *Repository) KeywordSearch(ctx context.Context, query string, limit int) ([]domain.Memory, error)
- func (r *Repository) ListMemories(ctx context.Context, limit int) ([]domain.Memory, error)
- func (r *Repository) ListMemoriesNeedingIndex(ctx context.Context, identity EmbeddingIdentity) ([]domain.Memory, error)
- func (r *Repository) RecallSearch(ctx context.Context, query string, limit int, recentWindow int, ...) ([]domain.Memory, error)
- func (r *Repository) SemanticSearch(ctx context.Context, embedding []float32, limit int, ...) ([]SemanticHit, error)
- func (r *Repository) UpsertMemoryEmbedding(ctx context.Context, id int64, embedding []float32, identity EmbeddingIdentity) error
- type SemanticHit
Constants ¶
View Source
const ( DefaultListLimit = 100 DefaultKeywordLimit = 10 DefaultSemanticLimit = 3 DefaultSemanticMaxDistance = 0.80 DefaultRecentWindow = 2000 DefaultRecallCandidateMin = 64 MaxListLimit = 1000 MaxSearchLimit = 100 MaxSemanticLimit = 100 MaxRecentWindow = 5000 MaxRecallCandidates = 1000 )
Variables ¶
View Source
var ErrDatabaseNotFound = errors.New("database not found")
View Source
var ErrMemoryNotFound = errors.New("memory not found")
View Source
var ErrMigrationRequired = errors.New("database needs an automatic update but is not writable")
Functions ¶
func CheckCompatible ¶
func IsDatabaseNotFound ¶
func IsMigrationRequired ¶
Types ¶
type EmbeddingIdentity ¶
type IndexHealth ¶
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
func NewRepository ¶
func NewRepository(db *sql.DB) *Repository
func (*Repository) AddMemory ¶
func (r *Repository) AddMemory(ctx context.Context, text string, embedding []float32, identity EmbeddingIdentity) (domain.Memory, error)
func (*Repository) CountMemories ¶
func (r *Repository) CountMemories(ctx context.Context) (int64, error)
func (*Repository) EditMemory ¶
func (r *Repository) EditMemory(ctx context.Context, id int64, text string, embedding []float32, identity EmbeddingIdentity) (domain.Memory, error)
func (*Repository) ForgetMemory ¶
func (r *Repository) ForgetMemory(ctx context.Context, id int64) error
func (*Repository) IndexHealth ¶
func (r *Repository) IndexHealth(ctx context.Context, identity EmbeddingIdentity) (IndexHealth, error)
func (*Repository) KeywordSearch ¶
func (*Repository) ListMemories ¶
func (*Repository) ListMemoriesNeedingIndex ¶
func (r *Repository) ListMemoriesNeedingIndex(ctx context.Context, identity EmbeddingIdentity) ([]domain.Memory, error)
func (*Repository) RecallSearch ¶
func (*Repository) SemanticSearch ¶
func (r *Repository) SemanticSearch(ctx context.Context, embedding []float32, limit int, identity EmbeddingIdentity, maxDistance float64) ([]SemanticHit, error)
func (*Repository) UpsertMemoryEmbedding ¶
func (r *Repository) UpsertMemoryEmbedding(ctx context.Context, id int64, embedding []float32, identity EmbeddingIdentity) error
type SemanticHit ¶
Click to show internal directories.
Click to hide internal directories.