2024-05-10 20:49:47 -07:00
|
|
|
---
|
|
|
|
|
# https://vitepress.dev/reference/default-theme-home-page
|
|
|
|
|
layout: home
|
|
|
|
|
|
|
|
|
|
hero:
|
|
|
|
|
name: "sqlite-vec"
|
|
|
|
|
text: ""
|
|
|
|
|
tagline: A vector search SQLite extension that runs anywhere!
|
|
|
|
|
actions:
|
|
|
|
|
- theme: brand
|
|
|
|
|
text: Getting Started
|
2024-06-22 16:46:33 -07:00
|
|
|
link: /introduction
|
2024-05-10 20:49:47 -07:00
|
|
|
- theme: alt
|
|
|
|
|
text: API Reference
|
|
|
|
|
link: /api-reference
|
|
|
|
|
|
|
|
|
|
features:
|
|
|
|
|
- title: Runs everywhere
|
2024-06-22 16:46:33 -07:00
|
|
|
details: On laptops, servers, mobile devices, browsers with WASM, Raspberry Pis, and more!
|
2024-05-10 20:49:47 -07:00
|
|
|
- title: Bindings for many languages
|
|
|
|
|
details: Python, Ruby, Node.js/Deno/Bun, Go, Rust, and more!
|
2024-07-12 08:50:42 -07:00
|
|
|
- title: Pure SQL
|
|
|
|
|
details: No extra configuration or server required — only CREATE, INSERT, and SELECT statements
|
2024-05-10 20:49:47 -07:00
|
|
|
---
|
|
|
|
|
|
|
|
|
|
```sqlite
|
2024-06-22 16:46:33 -07:00
|
|
|
-- store 768-dimensional vectors in a vec0 virtual table
|
2024-05-10 20:49:47 -07:00
|
|
|
create virtual table vec_movies using vec0(
|
|
|
|
|
synopsis_embedding float[768]
|
|
|
|
|
);
|
|
|
|
|
|
2024-06-22 16:46:33 -07:00
|
|
|
-- insert vectors into the table, as JSON or compact BLOBs
|
2024-05-10 20:49:47 -07:00
|
|
|
insert into vec_movies(rowid, synopsis_embedding)
|
|
|
|
|
select
|
|
|
|
|
rowid,
|
|
|
|
|
embed(synopsis) as synopsis_embedding
|
|
|
|
|
from movies;
|
|
|
|
|
|
2024-06-22 16:46:33 -07:00
|
|
|
-- KNN search!
|
|
|
|
|
select
|
|
|
|
|
rowid,
|
|
|
|
|
distance
|
2024-05-10 20:49:47 -07:00
|
|
|
from vec_movies
|
|
|
|
|
where synopsis_embedding match embed('scary futuristic movies')
|
|
|
|
|
order by distance
|
|
|
|
|
limit 20;
|
|
|
|
|
```
|