Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@ragpipe/plugin-sqlite-vec

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ragpipe/plugin-sqlite-vec

SQLite local vector store plugin for ragpipe

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

@ragpipe/plugin-sqlite-vec

SQLite local vector store plugin for ragpipe.

This plugin is designed for local-first RAG setups. It stores vectors in a SQLite file and performs similarity scoring in plugin code, so you can run a fully local stack without a separate vector database server.

Pair it with @ragpipe/plugin-ollama for an all-local workflow.

Install

pnpm add ragpipe @ragpipe/plugin-sqlite-vec

If you use pnpm, you may also need to approve the native build for better-sqlite3:

pnpm approve-builds

Approve better-sqlite3, then reinstall or rebuild if needed:

pnpm rebuild better-sqlite3

Usage

import { defineConfig } from "ragpipe";
import { sqliteVectorStore } from "@ragpipe/plugin-sqlite-vec";

export default defineConfig({
  // ... embedding, generation
  vectorStore: sqliteVectorStore({
    path: "./rag.db",
    tableName: "documents", // default
    metaTableName: "ragpipe_meta", // default
  }),
});

Fully local example

import { defineConfig } from "ragpipe";
import {
  ollamaEmbedding,
  ollamaGeneration,
} from "@ragpipe/plugin-ollama";
import { sqliteVectorStore } from "@ragpipe/plugin-sqlite-vec";

export default defineConfig({
  embedding: ollamaEmbedding({
    model: "bge-m3",
    dimensions: 1024,
  }),
  vectorStore: sqliteVectorStore({
    path: "./rag.db",
  }),
  generation: ollamaGeneration({
    model: "llama3",
  }),
});

API

sqliteVectorStore(options)

Returns a VectorStorePlugin backed by a local SQLite database file.

OptionTypeDefaultDescription
pathstringSQLite database file path (required)
tableNamestring"documents"Table that stores documents and vectors
metaTableNamestring"ragpipe_meta"Table that stores plugin metadata such as embedding dimensions

Methods

MethodDescription
search(vector, topK)Loads rows from SQLite, scores cosine similarity in plugin code, and returns top matches
upsert(source, content, vector)Inserts or updates by UNIQUE(source, content_hash)
clear()Deletes all rows from the configured documents table
disconnect()Closes the underlying SQLite connection
isReady()Checks whether the documents table and metadata table already exist
setup(dimensions, options?)Creates or recreates the local schema and stores the configured embedding dimensions

Database Setup

setup() creates two tables automatically:

  • documents table: stores source, content, content_hash, and serialized vector
  • metadata table: stores plugin metadata including the configured embedding dimensions

If the store already has data and the configured embedding dimensions change, setup() throws a dimension mismatch error unless you pass { force: true }.

How Search Works

Current implementation behavior:

  • vectors are stored as serialized JSON in SQLite
  • similarity is computed with cosine similarity in plugin code
  • retrieval uses a full-table scan and then sorts results in memory

This is intentional for the first local MVP. It keeps setup simple and avoids requiring a separate vector extension or hosted service.

Notes

  • This plugin is best suited for local development, demos, and smaller datasets.
  • tableName and metaTableName are validated before being interpolated into SQL.
  • better-sqlite3 is used under the hood and is loaded at runtime by the plugin.
  • In pnpm projects, better-sqlite3 may require pnpm approve-builds before the native binding is available.
  • Dimension metadata is persisted so mismatched embedding models fail fast instead of silently returning bad search results.

License

MIT

Keywords

ragpipe

FAQs

Package last updated on 12 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts