Skip to main content

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

  1. Install SQLite if needed
    • on MacOS it is pre-installed
  2. Install the ModelFusion SQLite VSS extension:
    npm install @modelfusion/sqlite-vss
  3. Install the peer dependencies:
    npm install better-sqlite3 sqlite-vss
  4. 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

Examples

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),
});

Source Code

@modelfusion/sqlite-vss