mirror of
https://github.com/asg017/sqlite-vec.git
synced 2026-04-25 00:36:56 +02:00
examples + fmt
This commit is contained in:
parent
356f75cca7
commit
dd972f6ffe
16 changed files with 1064 additions and 25 deletions
|
|
@ -23,7 +23,7 @@ const query = [0.3, 0.3, 0.3, 0.3];
|
|||
db.exec("CREATE VIRTUAL TABLE vec_items USING vec0(embedding float[4])");
|
||||
|
||||
const insertStmt = db.prepare(
|
||||
"INSERT INTO vec_items(rowid, embedding) VALUES (?, ?)"
|
||||
"INSERT INTO vec_items(rowid, embedding) VALUES (?, ?)",
|
||||
);
|
||||
|
||||
const insertVectors = db.transaction((items) => {
|
||||
|
|
@ -44,7 +44,7 @@ const rows = db
|
|||
WHERE embedding MATCH ?
|
||||
ORDER BY distance
|
||||
LIMIT 5
|
||||
`
|
||||
`,
|
||||
)
|
||||
.all([new Uint8Array(new Float32Array(query).buffer)]);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue