mirror of
https://github.com/asg017/sqlite-vec.git
synced 2026-04-25 16:56:27 +02:00
nbc
This commit is contained in:
parent
dd972f6ffe
commit
47e61aa187
1 changed files with 7 additions and 5 deletions
|
|
@ -9,11 +9,6 @@
|
||||||
const sqlite3 = await init();
|
const sqlite3 = await init();
|
||||||
|
|
||||||
|
|
||||||
const extractor = await pipeline(
|
|
||||||
"feature-extraction",
|
|
||||||
"Xenova/all-MiniLM-L6-v2",
|
|
||||||
);
|
|
||||||
|
|
||||||
const dbContents = await fetch("articles.db").then((r) => r.arrayBuffer());
|
const dbContents = await fetch("articles.db").then((r) => r.arrayBuffer());
|
||||||
const db = new sqlite3.oo1.DB();
|
const db = new sqlite3.oo1.DB();
|
||||||
const p = sqlite3.wasm.allocFromTypedArray(dbContents);
|
const p = sqlite3.wasm.allocFromTypedArray(dbContents);
|
||||||
|
|
@ -27,6 +22,13 @@
|
||||||
);
|
);
|
||||||
db.checkRc(rc);
|
db.checkRc(rc);
|
||||||
|
|
||||||
|
const extractor = await pipeline(
|
||||||
|
"feature-extraction",
|
||||||
|
"Xenova/all-MiniLM-L6-v2",
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const query = "sports";
|
const query = "sports";
|
||||||
const queryEmbedding = await extractor([query], {
|
const queryEmbedding = await extractor([query], {
|
||||||
pooling: "mean",
|
pooling: "mean",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue