example updates

This commit is contained in:
Alex Garcia 2024-05-11 00:21:44 -07:00
parent 12c96fc6fe
commit 85fac4c5ef
10 changed files with 112 additions and 76 deletions

View file

@ -4,21 +4,24 @@
select sqlite_version(), vec_version();
CREATE VIRTUAL TABLE vec_items USING vec0(embedding float[8]);
CREATE VIRTUAL TABLE vec_items USING vec0(embedding float[4]);
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]]
[1, [0.1, 0.1, 0.1, 0.1]],
[2, [0.2, 0.2, 0.2, 0.2]],
[3, [0.3, 0.3, 0.3, 0.3]],
[4, [0.4, 0.4, 0.4, 0.4]],
[5, [0.5, 0.5, 0.5, 0.5]]
]');
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]'
WHERE embedding MATCH '[0.3, 0.3, 0.3, 0.3]'
ORDER BY distance
LIMIT 5;
LIMIT 3;