back to home

asg017 / sqlite-vec

A vector search SQLite extension that runs anywhere!

6,976 stars
283 forks
171 issues
CPythonMakefile

AI Architecture Analysis

This repository is indexed by RepoMind. By analyzing asg017/sqlite-vec in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.

Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.

Embed this Badge

Showcase RepoMind's analysis directly in your repository's README.

[![Analyzed by RepoMind](https://img.shields.io/badge/Analyzed%20by-RepoMind-4F46E5?style=for-the-badge)](https://repomind-ai.vercel.app/repo/asg017/sqlite-vec)
Preview:Analyzed by RepoMind

Repository Summary (README)

Preview

sqlite-vec

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

<!-- deno-fmt-ignore-start -->

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

<!-- deno-fmt-ignore-end -->
  • 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
<p align="center"> <a href="https://hacks.mozilla.org/2024/06/sponsoring-sqlite-vec-to-enable-more-powerful-local-ai-applications/"> <picture> <source media="(prefers-color-scheme: dark)" srcset="./.github/logos/mozilla.dark.svg"> <source media="(prefers-color-scheme: light)" srcset="./.github/logos/mozilla.svg"> <img alt="Mozilla Builders logo" width=400> </picture> </a> </p> <p align="center"> <i> <code>sqlite-vec</code> is a <a href="https://hacks.mozilla.org/2024/06/sponsoring-sqlite-vec-to-enable-more-powerful-local-ai-applications/">Mozilla Builders project</a>, with additional sponsorship from <a href="https://fly.io/"><img width=14px src="./.github/logos/flyio.small.ico"/> Fly.io </a>, <a href="https://tur.so/sqlite-vec"><img width=14px src="./.github/logos/turso.small.ico"/> Turso</a>, <a href="https://sqlitecloud.io/"><img width=14px src="./.github/logos/sqlitecloud.small.svg"/> SQLite Cloud</a>, and <a href="https://shinkai.com/"><img width=14px src="./.github/logos/shinkai.small.svg"/> Shinkai</a>. See <a href="#sponsors">the Sponsors section</a> for more details. </i> </p>

Installing

See Installing sqlite-vec for more details.

LanguageInstallMore Info
Pythonpip install sqlite-vecsqlite-vec with PythonPyPI
Node.jsnpm install sqlite-vecsqlite-vec with Node.jsnpm
Rubygem install sqlite-vecsqlite-vec with RubyGem
Gogo get -u github.com/asg017/sqlite-vec/bindings/gosqlite-vec with GoGo Reference
Rustcargo add sqlite-vecsqlite-vec with RustCrates.io
Datasettedatasette install datasette-sqlite-vecsqlite-vec with DatasetteDatasette
rqliterqlited -extensions-path=sqlite-vec.tar.gzsqlite-vec with rqliterqlite
sqlite-utilssqlite-utils install sqlite-utils-sqlite-vecsqlite-vec with sqlite-utilssqlite-utils
Github ReleaseGitHub 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.

<p align="center"> <a href="https://hacks.mozilla.org/2024/06/sponsoring-sqlite-vec-to-enable-more-powerful-local-ai-applications/"> <picture> <source media="(prefers-color-scheme: dark)" srcset="./.github/logos/mozilla.dark.svg"> <source media="(prefers-color-scheme: light)" srcset="./.github/logos/mozilla.svg"> <img alt="Mozilla Builders logo" width=400> </picture> </a> </p>

sqlite-vec is also sponsored by the following companies:

<a href="https://fly.io/"> <picture> <source media="(prefers-color-scheme: dark)" srcset="./.github/logos/flyio.dark.svg"> <source media="(prefers-color-scheme: light)" srcset="./.github/logos/flyio.svg"> <img alt="Fly.io logo" src="./.github/logos/flyio.svg" width="48%"> </picture> </a> <a href="https://tur.so/sqlite-vec"> <picture> <source media="(prefers-color-scheme: dark)" srcset="./.github/logos/turso.svg"> <source media="(prefers-color-scheme: light)" srcset="./.github/logos/turso.svg"> <img alt="Turso logo" src="./.github/logos/turso.svg" width="48%"> </picture> </a> <a href="https://sqlitecloud.io/"> <picture> <source media="(prefers-color-scheme: dark)" srcset="./.github/logos/sqlitecloud.dark.svg"> <source media="(prefers-color-scheme: light)" srcset="./.github/logos/sqlitecloud.svg"> <img alt="SQLite Cloud logo" src="./.github/logos/flyio.svg" width="48%"> </picture> </a> <a href="https://shinkai.com"> <picture> <source media="(prefers-color-scheme: dark)" srcset="./.github/logos/shinkai.dark.svg"> <source media="(prefers-color-scheme: light)" srcset="./.github/logos/shinkai.svg"> <img alt="Shinkai logo" src="./.github/logos/shinkai.svg" width="48%"> </picture> </a>

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