SQLite VSS Vector Index
SQLite VSS is a SQLite extension that provides vector similarity search (VSS) functionality based on Faiss.
info
Windows is currently not supported.
Setup
- Install SQLite if needed
- on MacOS it is pre-installed
- Install the ModelFusion SQLite VSS extension:
npm install @modelfusion/sqlite-vss
- Install the peer dependencies:
npm install better-sqlite3 sqlite-vss
- Install the library for your architecture:
npm install sqlite-vss-darwin-x64
npm install sqlite-vss-darwin-arm64
npm install sqlite-vss-linux-x64
Usage
Create a Vector Index
import {
SQLiteVectorIndex,
setupSQLiteDatabase,
} from "@modelfusion/sqlite-vss";
import { zodSchema } from "modelfusion";
// Initialize the SQLite database:
const database = setupSQLiteDatabase(new BetterSqlite3(":memory:"));
// Create a vector index:
const vectorIndex = new SQLiteVectorIndex({
db: database,
schema: zodSchema(zodSchema),
});