mirror of
https://github.com/asg017/sqlite-vec.git
synced 2026-04-25 00:36:56 +02:00
example updates
This commit is contained in:
parent
12c96fc6fe
commit
85fac4c5ef
10 changed files with 112 additions and 76 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue