RAG Service
A self-hosted RAG service with hybrid search (semantic + BM25), admin dashboard, and Claude Code plugin for agent integration.
Architecture
rag-service
┌─────────────────────────────────────────────────────────┐
│ │
│ ┌─────────┐ ┌──────────┐ ┌───────────────────┐ │
│ │ Adapter │──>│ Screening│──>│ Chunk + Embed │ │
│ │ (json,md)│ │ + Redact │ │ (configurable API)│ │
│ └─────────┘ └──────────┘ └────────┬───────────┘ │
│ ^ │ │
│ │ --input / --dry-run │ │
│ │ --dry-run │ │
│ v │
│ ┌──────────────────────────────────────────────┐ │
│ │ Direct PostgreSQL + pgvector │ │
│ │ │ │
│ │ kb_chunks │ │
│ │ ┌─────┬──────┬───────────┬──────────┐ │ │
│ │ │ id │ text │ embedding │ source/tags│ │ │
│ │ └─────┴──────┴───────────┴──────────┘ │ │
│ │ │ │
│ │ ACL, audit log, feedback, and query signals │ │
│ └──────────────────────────────────────────────┘ │
│ │ │
│ ┌──────────┴──────────┐ │
│ v v │
│ ┌─────────────────┐ ┌──────────────────┐ │
│ │ BM25 search │ │ Semantic search │ │
│ │ (Intl.Segmenter │ │ (pgvector cosine)│ │
│ │ + Porter stem) │ └────────┬─────────┘ │
│ └────────┬────────┘ │ │
│ └──────────┬──────────┘ │
│ v │
│ ┌─────────────────┐ │
│ │ RRF Fusion │ │
│ │ (keyword 0.25 + │ │
│ │ semantic 0.75) │ │
│ └────────┬────────┘ │
│ v │
│ ┌────────────────────────────────────────────┐ │
│ │ /api/query → chunks + optional LLM RAG │ │
│ │ /api/learn → add chunk (unverified) │ │
│ │ /api/report → flag content issue │ │
│ │ /dashboard → admin UI │ │
│ └────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────┘
Agent Curation Loop
┌───────────────────────────────────────┐
│ │
│ search ──> learn/report │
│ │ │
│ v │
│ triage ──> inspect ──> edit/verify │
│ │ │
│ v │
│ curate (walks queue item-by-item) │
│ │ │
│ v │
│ improved KB ──> better search ──> │
└───────────────────────────────────────┘
Getting Started
1. Create a Zeabur Project
Go to Zeabur Dashboard and create a new project.
2. Add PostgreSQL with pgvector
The Marketplace template provisions pgvector/pgvector automatically. For a
manual deployment, provide a PostgreSQL database where the service account can
run CREATE EXTENSION vector and schema migrations.
3. Configure model credentials
Provide an OpenAI-compatible embedding endpoint and key. Answer generation is
optional and uses an OpenAI-compatible chat-completions endpoint.
EMBEDDING_API_KEY (or ZEABUR_AI_HUB_API_KEY)
EMBEDDING_API_URL (optional; defaults to https://api.openai.com/v1)
LLM_API_KEY / LLM_API_URL for RAG answers and optional LLM features
4. Deploy RAG Service
In your project, click Add Service → Marketplace, search for RAG Service, and fill in:
- The PostgreSQL connection is injected automatically by the template
- A Zeabur AI Hub key for answer generation
- A Gemini API key for the Marketplace template's default embedding provider,
or credentials for another OpenAI-compatible embedding provider when
deploying manually

Schema migrations run automatically on first startup — no manual setup needed.
API Endpoints