Skip to main content

sqlite_plus_vec 0.1.6 copy "sqlite_plus_vec: ^0.1.6" to clipboard
sqlite_plus_vec: ^0.1.6 copied to clipboard

Brute-force vec0 vector search for sqlite_plus, with exact filtered ranking.

example/README.md

Nearest notes #

One in-memory vec0 table. The mapping lives in lib/nearest_notes.dart. It uses sqlite_plus_orm for the table and sqlite_plus_vec for the module. The engine underneath is sqlite_plus.

Point has a generated rowid and List<double> embedding. The entity is DbModules.vec0. The column is Codecs.vector(2) with DbVectorMetrics.l2. The created SQL contains float[2] distance_metric=l2.

runNearestNotes does five steps:

  1. The example writes points.db and reads that file back.
  2. SqlitePlusVec.register(connection.database) installs vec0 on that connection.
  3. ensureCreated creates the virtual table and its shadow.
  4. Two vectors are saved: [1, 0] and [0, 1].
  5. nearest(const [0.9, 0.1], k: 1) returns one row. A second plan() is empty.

From a checkout, after dart pub get at the repository root:

dart run bin/main.dart
1.0 | stable true

1.0 is the first coordinate of the returned vector. [0.9, 0.1] is closer to [1, 0] than to [0, 1], so the row is the first saved vector. The scan compares both stored rows. stable true means the migration plan after the save is empty.

The package README walks through k = 2, cosine distance, and the same query from SQL and from a generated nearest method. The image is a sqlite_plus database. A sqlite-vec file is a different format.

0
likes
160
points
758
downloads

Documentation

API reference

Publisher

verified publisherquds.cc

Weekly Downloads

Brute-force vec0 vector search for sqlite_plus, with exact filtered ranking.

Repository (GitHub)
View/report issues

Topics

#sqlite #vector #embeddings

License

MIT (license)

Dependencies

sqlite_plus

More

Packages that depend on sqlite_plus_vec