Skip to content

RAG Pipeline

Scaffolds a Retrieval-Augmented Generation pipeline in TypeScript. Implements document ingestion, configurable chunking strategies, embedding generation, vector storage, similarity retrieval, and LLM-powered answer generation with source citations. No LangChain — all components are built from first principles using the provider SDKs directly. Defaults to AWS Bedrock (Claude via Converse with prompt caching for generation, Titan v2 for embeddings, on IRSA — no keys). Supports multiple vector stores (pgvector, Chroma, Qdrant, Pinecone), alternate embedding providers (OpenAI, Cohere), and alternate LLM providers (Anthropic, OpenAI).

Namerag-pipeline
Version0.1.0
Categoryai-systems
LicenseApache-2.0
Personaengineering
Tagstypescript, rag, embeddings, vector-search, llm, retrieval, ai
Sourcetemplates/rag-pipeline

Render it

Three front doors, one catalog. Pick whichever suits the caller.

# CLI
npx @nanohype/sdk render rag-pipeline --out ./my-app

# SDK
import { LocalSource, renderTemplate } from "@nanohype/sdk";
const result = await renderTemplate(source, "rag-pipeline", variables);

# MCP — from an agent
get_template({ name: "rag-pipeline" })

Prerequisites

ToolVersionWhy
node>=24Node.js runtime for TypeScript execution

Variables

Required

ProjectName string
Kebab-case project name, used in package.json and directory names Must be lowercase kebab-case starting with a letter.

Optional

Description string — defaults to A retrieval-augmented generation pipeline
Short project description for package.json and README
VectorStore string — defaults to chroma
Vector database backend for storing and querying embeddings (e.g. chroma, pgvector, qdrant, pinecone)
EmbeddingProvider string — defaults to bedrock
Provider for text embeddings — bedrock (Titan v2, default), openai, or cohere
LlmProvider string — defaults to bedrock
LLM provider for answer generation — bedrock (default), anthropic, or openai
ChunkStrategy string — defaults to recursive
Text chunking strategy for splitting documents
IncludeTests bool — defaults to true
Include vitest test suite with chunking, retrieval, and registry tests

What it produces

38 files. Placeholder names such as __APP_NAME__ are what the renderer substitutes into.

.dockerignore
.env.example
.github/workflows/ci.yml
.gitignore
biome.json
Dockerfile
package.json
README.md
src/__tests__/chunking.test.ts
src/__tests__/pipeline.integration.test.ts
src/__tests__/registry.test.ts
src/__tests__/retrieval.test.ts
src/bootstrap.ts
src/chunking.ts
src/config.ts
src/generation.ts
src/index.ts
src/ingest.ts
src/logger.ts
src/providers/__tests__/chroma.integration.test.ts
src/providers/anthropic.ts
src/providers/bedrock.ts
src/providers/chroma.ts
src/providers/cohere.ts
src/providers/index.ts
src/providers/mock-vectorstore.ts
src/providers/mock.ts
src/providers/openai.ts
src/providers/pgvector.ts
src/providers/pinecone.ts
src/providers/qdrant.ts
src/providers/registry.ts
src/providers/types.ts
src/resilience/__tests__/circuit-breaker.test.ts
src/resilience/circuit-breaker.ts
src/retrieval.ts
tsconfig.json
vitest.config.ts

Composes with

Composites that use it

  • AI Web Application — Full-stack web application with Next.js frontend, RAG pipeline, authentication, database, and deployment..
  • Document Intelligence — Document search and question-answering system with RAG pipeline, HTTP service, file storage, database, and deployment..
  • Enterprise AI Infrastructure — Full enterprise AI stack with agents, tool servers, safety guardrails, evaluation, prompt management, observability, and Kubernetes deployment..
  • RAG-Powered Agent — AI agent that uses retrieval-augmented generation as a tool.