knox ревизій цього gist . До ревизії
1 file changed, 14 insertions
LanceDB-1.js(файл створено)
@@ -0,0 +1,14 @@ | |||
1 | + | import * as lancedb from "@lancedb/lancedb"; | |
2 | + | ||
3 | + | const db = await lancedb.connect("data/sample-lancedb"); | |
4 | + | const table = await db.createTable("vectors", [ | |
5 | + | { id: 1, vector: [0.1, 0.2], item: "foo", price: 10 }, | |
6 | + | { id: 2, vector: [1.1, 1.2], item: "bar", price: 50 }, | |
7 | + | ], {mode: 'overwrite'}); | |
8 | + | ||
9 | + | ||
10 | + | const query = table.vectorSearch([0.1, 0.3]).limit(2); | |
11 | + | const results = await query.toArray(); | |
12 | + | ||
13 | + | // You can also search for rows by specific criteria without involving a vector search. | |
14 | + | const rowsByCriteria = await table.query().where("price >= 10").toArray(); |
Новіше
Пізніше