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

ragpipe

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ragpipe

Pluggable TypeScript RAG toolkit — defineConfig() one file, embed → search → generate.

latest
Source
npmnpm
Version
0.10.0
Version published
Maintainers
1
Created
Source

ragpipe

Pluggable TypeScript RAG toolkit — defineConfig() one file, embed → search → generate.

Install

pnpm add ragpipe

Quick Start

CLI

# Scaffold a ragpipe.config.ts
npx ragpipe init

# Set up vector store schema
npx ragpipe setup

# Ingest documents
npx ragpipe ingest ./docs

# Ask a question
npx ragpipe ask "What is the refund policy?"

Programmatic

import { loadConfig, createPipeline } from "ragpipe";

const config = await loadConfig();
const rag = createPipeline(config);

await rag.ingest(markdownText, "docs/guide.md");

const result = await rag.ask("How does authentication work?");
console.log(result.answer);
console.log(result.sources.map((s) => s.source));

Configuration

Create a ragpipe.config.ts at your project root:

import { defineConfig } from "ragpipe";
import { geminiEmbedding, geminiGeneration } from "@ragpipe/plugin-gemini";
import { supabaseVectorStore } from "@ragpipe/plugin-supabase";

export default defineConfig({
  embedding: geminiEmbedding({
    apiKey: process.env.GEMINI_API_KEY ?? "",
  }),
  vectorStore: supabaseVectorStore({
    supabaseUrl: process.env.SUPABASE_URL ?? "",
    supabaseKey: process.env.SUPABASE_SERVICE_ROLE_KEY ?? "",
  }),
  generation: geminiGeneration({
    apiKey: process.env.GEMINI_API_KEY ?? "",
  }),
});

API

defineConfig(config)

Identity helper that provides type-safe autocompletion for your config file.

loadConfig(overrides?)

Loads ragpipe.config.ts from the project root using c12. Validates that embedding, vectorStore, and generation plugins are present.

createPipeline(config)

Returns a pipeline with three methods:

MethodDescription
ingest(text, source)Chunk text, embed each chunk, and store vectors. Returns chunk count.
search(query, topK?)Embed the query and return the top-K matching documents.
ask(query, topK?)Search for context, then generate an answer. Returns { answer, sources }.

defaultChunker(options?)

Built-in paragraph-based chunker. Options: chunkSize (default 500), overlap (default 50).

createRateLimitedEmbedder(plugin)

Wraps an EmbeddingPlugin with throttling based on its rateLimit.delayMs.

Plugin Interfaces

Implement any of these to create a custom plugin:

  • EmbeddingPluginembed(text), optional embedMany(texts), rateLimit
  • VectorStorePluginsearch(vector, topK), upsert(source, content, vector), optional clear(), disconnect()
  • GenerationPlugingenerate(question, context, options?), optional generateStream()
  • ChunkerPluginchunk(text, source)

Official Plugins

PackageDescription
@ragpipe/plugin-geminiGoogle Gemini embedding + generation
@ragpipe/plugin-openaiOpenAI embedding + generation
@ragpipe/plugin-ollamaOllama local embedding + generation
@ragpipe/plugin-cloudflareCloudflare Workers AI embedding + generation
@ragpipe/plugin-supabaseSupabase pgvector store

License

MIT

Keywords

rag

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