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-supabase

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ragpipe/plugin-supabase

Supabase pgvector vector store plugin for ragpipe

latest
Source
npmnpm
Version
0.5.0
Version published
Weekly downloads
29
61.11%
Maintainers
1
Weekly downloads
 
Created
Source

@ragpipe/plugin-supabase

Supabase vector store plugin for ragpipe, powered by @supabase/supabase-js.

Install

pnpm add ragpipe @ragpipe/plugin-supabase

Usage

import { defineConfig } from "ragpipe";
import { supabaseVectorStore } from "@ragpipe/plugin-supabase";

export default defineConfig({
  // ... embedding, generation
  vectorStore: supabaseVectorStore({
    supabaseUrl: process.env.SUPABASE_URL ?? "",
    supabaseKey: process.env.SUPABASE_SERVICE_ROLE_KEY ?? "",
    tableName: "documents",   // default
    queryName: "match_documents", // default RPC function name
  }),
});

API

supabaseVectorStore(options)

Returns a VectorStorePlugin backed by Supabase using the official JS SDK.

OptionTypeDefaultDescription
supabaseUrlstringSupabase project URL (required)
supabaseKeystringService role key (required)
tableNamestring"documents"Table to store documents
queryNamestring"match_documents"PostgreSQL function for vector search

Methods

MethodDescription
search(vector, topK)Calls supabase.rpc() for cosine similarity search
upsert(source, content, vector)Inserts via supabase.from().upsert() with dedup on source,content
clear()Deletes all rows from the documents table
disconnect()No-op (Supabase JS client manages connections automatically)

Database Setup

Run the following in your Supabase SQL editor:

-- 1. Enable pgvector
CREATE EXTENSION IF NOT EXISTS vector;

-- 2. Create the documents table
CREATE TABLE documents (
  id BIGSERIAL PRIMARY KEY,
  source TEXT NOT NULL,
  content TEXT NOT NULL,
  vector VECTOR(3072),
  UNIQUE(source, content)
);

-- 3. Create the similarity search function
CREATE OR REPLACE FUNCTION match_documents(
  query_embedding VECTOR(3072),
  match_count INT DEFAULT 5
)
RETURNS TABLE (
  source TEXT,
  content TEXT,
  similarity FLOAT
)
LANGUAGE plpgsql
AS $$
BEGIN
  RETURN QUERY
  SELECT
    d.source,
    d.content,
    1 - (d.vector <=> query_embedding) AS similarity
  FROM documents d
  ORDER BY d.vector <=> query_embedding
  LIMIT match_count;
END;
$$;

-- 4. Create an index for faster search
CREATE INDEX ON documents
  USING ivfflat (vector vector_cosine_ops)
  WITH (lists = 100);

Adjust VECTOR(3072) to match your embedding model's dimensions.

License

MIT

Keywords

ragpipe

FAQs

Package last updated on 10 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