We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
if index is empty i get error on query data
code sample
import { EmbeddingModel, FlagEmbedding } from 'fastembed' import Database from "better-sqlite3"; import * as sqlite_vss from "sqlite-vss"; const setupDb = (path) => { const db = new Database(path); sqlite_vss.load(db); db.exec(` CREATE TABLE IF NOT EXISTS nodes ( id PRIMARY KEY NOT NULL, label VARCHAR ) `) db.exec(`select crsql_as_crr('nodes');`) console.log('1') db.exec(` create virtual table node_vector using vss0( vectorLabel(768) ); `) // db.exec(`select crsql_as_crr('node_vector');`) return db } const main = async () => { const embeddingModel = await FlagEmbedding.init({ model: EmbeddingModel.BGEBaseENV15 }); const db1 = setupDb('1-empty.sqlite') // query vectors const query = 'cat drink coffee' const queryVector = JSON.stringify(Array.from( await embeddingModel.queryEmbed(query))) console.log('before query') const q = db1.prepare(' select * from node_vector').all() console.log(q) console.log('after query') const vectorSearchQuery = db1.prepare( `with matches as ( select rowid, distance from node_vector where vss_search(vectorLabel, @qv) limit 10 ) select nodes.id, nodes.label, matches.distance from matches left join nodes on nodes.rowid = matches.rowid`, ) const result = vectorSearchQuery.all({qv: queryVector}) console.log('after query 2 ', result) db1.exec(`select crsql_finalize();`) db1.close() } main().catch().then(() => console.log('done'))
The text was updated successfully, but these errors were encountered:
No branches or pull requests
if index is empty i get error on query data
code sample
The text was updated successfully, but these errors were encountered: