Database instance (supports node:sqlite, better-sqlite3, @photostructure/sqlite)
import { DatabaseSync } from "@photostructure/sqlite"; // or node:sqlite, or better-sqlite3
import { loadDiskAnnExtension } from "@photostructure/sqlite-diskann";
const db = new DatabaseSync(":memory:");
loadDiskAnnExtension(db);
// Now you can use DiskANN functions
db.exec(`
CREATE VIRTUAL TABLE embeddings USING diskann(
dimension=512,
metric=cosine
)
`);
Load the DiskANN extension into a SQLite database