MCPcopy Index your code
hub / github.com/asg017/sqlite-vec

github.com/asg017/sqlite-vec @v0.1.9

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.1.9 ↗ · + Follow
513 symbols 1,418 edges 62 files 54 documented · 11% 14 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

sqlite-vec

An extremely small, "fast enough" vector search SQLite extension that runs anywhere! A successor to sqlite-vss

[!IMPORTANT] sqlite-vec is a pre-v1, so expect breaking changes!

  • Store and query float, int8, and binary vectors in vec0 virtual tables
  • Written in pure C, no dependencies, runs anywhere SQLite runs (Linux/MacOS/Windows, in the browser with WASM, Raspberry Pis, etc.)
  • Store non-vector data in metadata, auxiliary, or partition key columns

<img alt="Mozilla Builders logo" width=400>

sqlite-vec is a Mozilla Builders project, with additional sponsorship from Fly.io , Turso, SQLite Cloud, and Shinkai. See the Sponsors section for more details.

Installing

See Installing sqlite-vec for more details.

Language Install More Info
Python pip install sqlite-vec sqlite-vec with Python PyPI
Node.js npm install sqlite-vec sqlite-vec with Node.js npm
Ruby gem install sqlite-vec sqlite-vec with Ruby Gem
Go go get -u github.com/asg017/sqlite-vec/bindings/go sqlite-vec with Go Go Reference
Rust cargo add sqlite-vec sqlite-vec with Rust Crates.io
Datasette datasette install datasette-sqlite-vec sqlite-vec with Datasette Datasette
rqlite rqlited -extensions-path=sqlite-vec.tar.gz sqlite-vec with rqlite rqlite
sqlite-utils sqlite-utils install sqlite-utils-sqlite-vec sqlite-vec with sqlite-utils sqlite-utils
Github Release GitHub tag (latest SemVer pre-release)

Sample usage

.load ./vec0

create virtual table vec_examples using vec0(
  sample_embedding float[8]
);

-- vectors can be provided as JSON or in a compact binary format
insert into vec_examples(rowid, sample_embedding)
  values
    (1, '[-0.200, 0.250, 0.341, -0.211, 0.645, 0.935, -0.316, -0.924]'),
    (2, '[0.443, -0.501, 0.355, -0.771, 0.707, -0.708, -0.185, 0.362]'),
    (3, '[0.716, -0.927, 0.134, 0.052, -0.669, 0.793, -0.634, -0.162]'),
    (4, '[-0.710, 0.330, 0.656, 0.041, -0.990, 0.726, 0.385, -0.958]');


-- KNN style query
select
  rowid,
  distance
from vec_examples
where sample_embedding match '[0.890, 0.544, 0.825, 0.961, 0.358, 0.0196, 0.521, 0.175]'
order by distance
limit 2;
/*
┌───────┬──────────────────┐
│ rowid │     distance     │
├───────┼──────────────────┤
│ 2     │ 2.38687372207642 │
│ 1     │ 2.38978505134583 │
└───────┴──────────────────┘
*/

Sponsors

Development of sqlite-vec is supported by multiple generous sponsors! Mozilla is the main sponsor through the new Builders project.

<img alt="Mozilla Builders logo" width=400>

sqlite-vec is also sponsored by the following companies:

Fly.io logo

Turso logo

SQLite Cloud logo

Shinkai logo

As well as multiple individual supporters on Github sponsors!

If your company interested in sponsoring sqlite-vec development, send me an email to get more info: https://alexgarcia.xyz

See Also

  • sqlite-ecosystem, Maybe more 3rd party SQLite extensions I've developed
  • sqlite-rembed, Generate text embeddings from remote APIs like OpenAI/Nomic/Ollama, meant for testing and SQL scripts
  • sqlite-lembed, Generate text embeddings locally from embedding models in the .gguf format

Core symbols most depended-on inside this repo

vtab_set_error
called by 134
sqlite-vec.c
exec
called by 127
tests/helpers.py
vec0_scanner_next
called by 54
sqlite-vec.c
bitmap_set
called by 44
sqlite-vec.c
_f32
called by 37
tests/helpers.py
vec0_shadow_table_contents
called by 26
tests/helpers.py
vec0_parse_vector_column
called by 23
sqlite-vec.c
vec0_token_next
called by 19
sqlite-vec.c

Shape

Function 442
Class 49
Enum 18
Method 4

Languages

C57%
Python37%
Rust3%
C++2%
TypeScript1%
Go1%

Modules by API surface

sqlite-vec.c263 symbols
tests/test-loadable.py77 symbols
benchmarks/exhaustive-memory/bench.py27 symbols
tests/test-insert-delete.py21 symbols
tests/test-metadata.py18 symbols
tests/test-unit.c11 symbols
tests/sqlite-vec-internal.h9 symbols
tests/test-partition-keys.py7 symbols
tests/test-auxiliary.py6 symbols
tests/unittest.rs5 symbols
tests/helpers.py5 symbols
tests/afbd/test-afbd.py5 symbols

For agents

$ claude mcp add sqlite-vec \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact