Documentation
¶
Overview ¶
Package sqlitevec stores chunk embedding vectors in the same SQLite database as the document metadata, using the sqlite-vec extension's vec0 virtual table. Search is exact (brute-force) K-nearest-neighbour over unit-normalized vectors, so L2 distance ranks the same as cosine similarity.
Index ¶
- func OpenVectorStorage(ctx context.Context, path string, dimensions int) (storage.VectorStorage, error)
- type Store
- func (s *Store) Close() error
- func (s *Store) Delete(ctx context.Context, chunkIDs []int64) error
- func (s *Store) EnsureSchema(ctx context.Context) error
- func (s *Store) Replace(ctx context.Context, embeddings []storage.ChunkEmbedding) error
- func (s *Store) Search(ctx context.Context, query []float32, limit int) ([]storage.VectorHit, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OpenVectorStorage ¶ added in v1.7.0
func OpenVectorStorage(ctx context.Context, path string, dimensions int) (storage.VectorStorage, error)
OpenVectorStorage opens the vector store; Open already prepares the schema. It returns the interface so a failure yields a nil storage.VectorStorage, not a typed nil.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func Open ¶
Open connects to the SQLite database at path and ensures the vec0 vector table exists. The vectors live in the same file as the documents/chunks tables.
func (*Store) EnsureSchema ¶
EnsureSchema creates the vec0 virtual table if it does not exist. The vector column is a fixed-length float32 list sized to the configured embedding dimensions.