sqlitevec

package
v0.0.1-rc.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package sqlitevec provides a SQLite-backed vector driver using sqlite-vec.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// DBPath is the path to the SQLite database file.
	// Use ":memory:" for an in-memory database.
	DBPath string

	// Dimensions is the number of dimensions for the embedding vectors.
	// Defaults to DefaultDimensions if zero.
	Dimensions uint
}

Config holds configuration for the SQLite vec driver.

type Driver

type Driver struct {
	// contains filtered or unexported fields
}

Driver implements vector.Driver using SQLite with sqlite-vec.

func NewDriver

func NewDriver(c Config, log *slog.Logger) (*Driver, error)

NewDriver creates a new SQLite vector driver backed by sqlite-vec.

func (*Driver) Add

func (d *Driver) Add(ctx context.Context, docs []vector.Document) error

Add stores documents with their embeddings. If a document with the same ID already exists, it is updated.

func (*Driver) Close

func (d *Driver) Close() error

Close releases resources held by the driver.

func (*Driver) Delete

func (d *Driver) Delete(ctx context.Context, ids []string) error

Delete removes documents by their IDs.

func (*Driver) Get

func (d *Driver) Get(ctx context.Context, ids []string) ([]vector.Document, error)

Get retrieves documents by their IDs.

func (*Driver) Query

func (d *Driver) Query(ctx context.Context, embedding []float32, topK int) ([]vector.QueryResult, error)

Query finds the topK most similar documents to the given embedding.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL