AbsoluteJS

RAG

@absolutejs/ragv0.6.2betaAI

Standalone RAG runtime for Bun and Elysia apps: ingestion, hybrid retrieval, source sync, and evaluation over pluggable vector stores.

A standalone RAG runtime for Bun and Elysia apps covering the full pipeline: document ingestion and chunking, embedding, hybrid retrieval with reranking, source sync, and retrieval-quality evaluation. Vector storage is pluggable behind a single RAGVectorStore contract, with published adapters for Postgres (pgvector), SQLite, and Pinecone alongside a built-in in-memory store. It pairs with @absolutejs/ai for the model side and ships framework bindings for React, Vue, Svelte, and Angular via subpath exports.

#Installation

BASH
bun add @absolutejs/rag

#Capabilities

Overview

A standalone RAG runtime for Bun and Elysia applications covering document ingestion, chunking, embeddings, hybrid retrieval, reranking, source synchronization, evaluation, client primitives, and framework bindings.

Retrieval and storage

The built-in memory store supports development and tests. Published adapters provide PostgreSQL with pgvector, SQLite with optional vec0 acceleration, and Pinecone behind the same RAGVectorStore contract. Lexical and vector results can be fused, transformed, and reranked with provider or heuristic rerankers.

Ingestion and source sync

The ingestion pipeline handles files, directories, uploads, URLs, PDFs, office documents, archives, images, and media transcripts. Scheduled connectors can keep collections synchronized from email, GitHub, sitemaps, feeds, directories, and S3-compatible storage.

Quality and evaluation

@absolutejs/rag/quality evaluates retrieval relevance and answer grounding, compares strategies and rerankers, and records runs against a baseline so retrieval changes can be tested before release.

Client and framework entry points

@absolutejs/rag/client and /client/ui provide browser-side primitives.

@absolutejs/rag/react, /vue, /svelte, and /angular provide framework bindings.

@absolutejs/rag/adapter-kit exposes the contracts used by vector-store adapters.

Show 2 more

@absolutejs/rag/ui exposes presentation-neutral UI contracts.

Pair the retrieval runtime with @absolutejs/ai when retrieved context should feed a model or streaming assistant.

Pluggable vector stores

One RAGVectorStore contract with an in-memory store built in and Postgres, SQLite, and Pinecone adapters published separately, so swapping backends does not touch retrieval code.

Provider-agnostic embeddings

Embedding providers for OpenAI, Gemini, Mistral, Ollama, xAI, DeepSeek, and more, plus any OpenAI-compatible endpoint, behind a single provider interface.

Hybrid retrieval and reranking

Lexical and vector results fuse into hybrid search, with query transforms and rerankers (Cohere, Jina, Voyage, or heuristic) applied per collection.

File ingestion pipeline

Extractors for PDFs (including OCR), EPUB, office and legacy documents, archives, images, and media transcripts turn raw files, directories, uploads, and URLs into chunked documents.

Source sync and scheduling

Sync sources for email (Gmail, Microsoft Graph, IMAP), GitHub repos, sitemaps, feeds, directories, and S3-compatible storage keep collections current on a scheduler.

Retrieval evaluation suites

Evaluation suites score retrieval and answer grounding, compare strategies and rerankers, and persist run history so retrieval changes ship against a baseline.

Outcomes

What you can build

Build complete retrieval pipelines

Ingest files, URLs, office documents, archives, images, and media transcripts; synchronize durable sources; and search with lexical, vector, hybrid, transformed, and reranked retrieval.

Choose storage without changing the app

Swap memory, PostgreSQL/pgvector, SQLite/vec0, and Pinecone stores behind one contract and expose retrieval through framework-neutral or framework-specific clients.

Hardening checklist

Production guidance

Treat retrieval quality as a release gatePersist source checkpoints, make ingestion idempotent, pin embedding dimensions, test retrieval relevance and grounding, compare rerankers, and block releases that regress the evaluation baseline.

Follow in order

Troubleshooting path

1
Retrieval quality regressed
Separate ingestion, chunking, embedding, storage, lexical retrieval, vector retrieval, fusion, reranking, and answer grounding. Evaluate each stage against a retained baseline.

#Quick start

Partial snippet

Working example for Quick start.

TS
import {
	createInMemoryRAGStore,
	createRAGCollection,
	ingestRAGDocuments,
	openaiEmbeddings,
	searchDocuments
} from '@absolutejs/rag';

const collection = createRAGCollection({
	embedding: openaiEmbeddings({
		apiKey: process.env.OPENAI_API_KEY ?? '',
		defaultModel: 'text-embedding-3-small'
	}),
	store: createInMemoryRAGStore()
});

await ingestRAGDocuments(collection, {
	documents: [{ id: 'intro', text: 'AbsoluteJS ships typed Bun primitives.' }]
});

const results = await searchDocuments(collection, {
	query: 'What does AbsoluteJS ship?',
	topK: 3
});

#Quick Start

Partial snippet

Create a collection over the built-in in-memory store, ingest documents, and run a similarity search.

TS
import {
	createInMemoryRAGStore,
	createRAGCollection,
	ingestRAGDocuments,
	openaiEmbeddings,
	searchDocuments
} from '@absolutejs/rag';

const collection = createRAGCollection({
	embedding: openaiEmbeddings({
		apiKey: process.env.OPENAI_API_KEY ?? '',
		defaultModel: 'text-embedding-3-small'
	}),
	store: createInMemoryRAGStore()
});

await ingestRAGDocuments(collection, {
	documents: [
		{
			id: 'getting-started',
			text: 'AbsoluteJS ships full-stack primitives for Bun and Elysia.',
			title: 'Getting Started'
		}
	]
});

const results = await searchDocuments(collection, {
	query: 'What does AbsoluteJS ship?',
	topK: 3
});

#Postgres (pgvector) Backend

Partial snippet

Swap the in-memory store for pgvector by installing @absolutejs/rag-postgres; the collection API stays identical.

TS
import { createPostgresRAG } from '@absolutejs/rag-postgres';

const { collection, store } = createPostgresRAG({
	storeOptions: {
		connectionString: process.env.DATABASE_URL,
		dimensions: 1536,
		distanceMetric: 'cosine',
		indexType: 'hnsw'
	}
});

#Vector store adapters

Published vector-store adapters that implement the RAGVectorStore contract from @absolutejs/rag. Each ships as its own package, so you install only the backend (and its heavy dependencies) you actually use.

@absolutejs/rag-pineconev0.0.13Pinecone vector-store adapter for @absolutejs/rag
@absolutejs/rag-postgresv0.0.12PostgreSQL (pgvector) vector-store adapter for @absolutejs/rag
@absolutejs/rag-sqlitev0.0.12SQLite vector-store adapter for @absolutejs/rag with optional native vec0 acceleration
Beta API
The package is pre-1.0 and its API surface is still settling; pin an exact version and review release notes when upgrading.
Subpath exports
Framework bindings live behind subpath exports (@absolutejs/rag/react, /vue, /svelte, /angular), and the adapter-kit subpath exposes the contract adapters build against.

#API reference

Search the declarations exported by the current package type files. Expand a symbol to inspect its source-backed signature.

80 symbols
ragChatexportPermalink
TS
ragChat
Exported from @absolutejs/rag

Current package surface

What ships today

@absolutejs/ragv0.6.2 · betaAInpmSource
12entry points360symbols

Import surface · click to copy