asg017 / sqlite-vss

A SQLite extension for efficient vector search, based on Faiss!
MIT License
1.59k stars 58 forks source link

Not loading in BUN #123

Open alfonsomenkel opened 4 months ago

alfonsomenkel commented 4 months ago

Bun has a builtin SQLite server. Following the instructions of node and Deno, the vertor0 loads and can see the log, bust vss0 doesn't, just stays there, no error no nothing. Any ideas?

xiankai commented 2 months ago

I was able to get bun to work with the standard instructions here: https://alexgarcia.xyz/sqlite-vss/nodejs.html

import Database from 'bun:sqlite'
import * as sqlite_vss from 'sqlite-vss'

const db = new Database(':memory:')
sqlite_vss.load(db)

const version = db.query(`select vss_version();`).get()
console.log(version) // { 'vss_version()': 'v0.1.2' }
alfonsomenkel commented 2 months ago

Hi,

I tried that before, but I tried it again just in case, but the same result. I'm using Mac OS and on Mac you have to use Database.setCustomSQLite to set the correct version of sqlite. My code is:

import * as sqlite_vss from 'sqlite-vss'
import Database from 'bun:sqlite'
Database.setCustomSQLite("/usr/local/Cellar/sqlite/3.45.2/lib/libsqlite3.0.dylib");

const db = new Database('test.db')
sqlite_vss.load(db)

const version = db.query(`select vss_version()`).get()
console.log(version) // { 'vss_version()': 'v0.1.2' 

As you can see, the code is almost the same except for the Mac part and the db. I don't know if it's a problem with the sqlite-vss, bun, Mac, sqlite or a skill issue, but as I don't get an error or anything and I don't know how to find out, but will keep trying.