mirror of
https://github.com/asg017/sqlite-vec.git
synced 2026-04-25 08:46:49 +02:00
start simple examples
This commit is contained in:
parent
2572aa1413
commit
e6067e2711
28 changed files with 1354 additions and 2 deletions
24
examples/simple-sqlite/demo.sql
Normal file
24
examples/simple-sqlite/demo.sql
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
.load ../../dist/vec0
|
||||
.mode box
|
||||
.header on
|
||||
|
||||
select sqlite_version(), vec_version();
|
||||
|
||||
CREATE VIRTUAL TABLE vec_items USING vec0(embedding float[8]);
|
||||
|
||||
INSERT INTO vec_items(rowid, embedding)
|
||||
select
|
||||
value ->> 0,
|
||||
value ->> 1
|
||||
from json_each('[
|
||||
[1, [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]],
|
||||
[2, [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]]
|
||||
]');
|
||||
|
||||
SELECT
|
||||
rowid,
|
||||
distance
|
||||
FROM vec_items
|
||||
WHERE embedding MATCH '[0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]'
|
||||
ORDER BY distance
|
||||
LIMIT 5;
|
||||
Loading…
Add table
Add a link
Reference in a new issue