Compare 10 state-of-the-art RAG architectures side-by-side on your own documents.
Built with Next.js + FastAPI — real-time streaming, adaptive learning, and a full evaluation suite.
Upload PDFs, DOCX, TXT, CSV, Excel, images, or URLs — then ask questions and watch each pipeline think in real time. Switch between architectures, run all 10 simultaneously in Compare mode, score answers with a RAGAS-inspired evaluator, and let the system learn from your feedback.
| # | Architecture | Core Idea | Best For |
|---|---|---|---|
| 01 | Hybrid RAG | Dense vectors + BM25 sparse search fused via Reciprocal Rank Fusion + cross-encoder re-ranking | General-purpose documents, mixed query types |
| 02 | Graph RAG | LLM-extracted entity/relationship triples → NetworkX knowledge graph + vector fallback | Documents rich in named entities and relationships |
| 03 | Agentic RAG | LangGraph planner routes to VECTOR_SEARCH, WEB_SEARCH, or direct answer; multi-hop decomposition | Queries needing web context or multi-step reasoning |
| 04 | Corrective RAG (CRAG) | Evaluator grades retrieved docs CORRECT / AMBIGUOUS / INCORRECT; rewrites query and falls back to web | When retrieval quality is uncertain |
| 05 | Multimodal RAG | Llama 4 Scout vision summarises uploaded images; base64 stored in metadata; image + text sent at query time | Documents with figures, charts, screenshots |
| 06 | Multilingual RAG | BGE-M3 cross-lingual embedding space (1024-dim, pre-loaded on startup); cross-encoder re-ranking; answers in the query's language | Multilingual documents or cross-language queries |
| 07 | RAG-Fusion | Expands query into 4 sub-queries, retrieves separately, merges all ranked lists with RRF | Ambiguous or broad queries |
| 08 | HyDE RAG | Generates a hypothetical ideal answer first, embeds it, uses it as the search vector | Short or keyword-style queries worded differently from source text |
| 09 | Structured RAG | CSV/Excel → pandas DataFrame; LLM generates pandas code from NL query and executes it | Spreadsheets, datasets, numerical analysis, filtering, aggregation |
| 10 | Self-RAG | Simulates Self-RAG paper tokens — grades relevance [IsRel], critiques faithfulness [IsSup] and completeness [IsUse]; refines and re-retrieves if scores below threshold |
When answer quality and factual grounding matter most |
- Live "brain working" view — real-time step indicators + token streaming with blinking cursor as each pipeline executes
- Compare mode — run all 10 architectures simultaneously; results in a card grid with expand-to-full-answer modal
- Per-architecture chat threads — independent conversation history per architecture with message count badges
- Source citations — collapsible panel showing retrieved chunks, source filenames, and relevance scores
- Multi-document support — additive ingestion; upload multiple files at once, mix PDFs, CSVs, URLs in any order
- Multi-document comparison — every context chunk is labelled
[Source: filename]; the LLM can compare content across different documents - URL ingestion — paste a webpage URL; it's scraped, chunked, and ingested automatically
- Document management — view all ingested files with chunk counts; delete individual files from all architectures
- API key management — set your Groq API key from the UI without restarting the server; auto-prompts on first launch
- Chat export — download current chat, all architecture chats, or compare results as Markdown files (3 export options)
- LocalStorage persistence — chat history survives page refreshes
- Persistent ChromaDB — vector store survives server restarts; documents don't need to be re-ingested
- Semantic query cache — queries with cosine similarity ≥ 0.95 (+ length-ratio guard) return instantly (⚡ badge)
- Clear cache — one-click cache clear from the sidebar action buttons
- Context quality self-evaluation — after retrieval, each pipeline evaluates its own context: CORRECT → generate, AMBIGUOUS → supplement with web search, INCORRECT → web search fallback
- Parent-child chunking — small child chunks (300 chars) embedded for precise retrieval; full parent chunk (1000 chars) used for richer generation context
- Feedback-driven retrieval — thumbs up/down on any answer; re-click to unmark; positively-rated chunks surface first in future queries; negatively-rated chunks are demoted
- Multi-hop decomposition — Agentic RAG splits complex multi-part queries into sub-questions, retrieves each independently, then merges context
- RAGAS-inspired 4-metric scorecard — Faithfulness, Answer Relevance, Context Precision, Context Recall (all 0–10)
- Analytics dashboard — per-architecture query count, average latency, eval scores (bar chart), cache hit rate, feedback ratio
- Architecture explainer — pipeline flow diagram, how-it-works text, best-use cases, and adaptive features per architecture
- OLED dark theme — deep black (
#07070f) base with violet (#7c3aed) accent and emerald active states - Compact sidebar — all 10 architectures visible at once with no inner scroll; action buttons always pinned at bottom
- Rich architecture header — full-width header with violet gradient wash, layered icon glow, tech-stack pill tags, Active chip, "How it works" and Knowledge Graph controls
- Glass surface cards — layered surface tokens, glow shadows, fade-in animations
- Real-time streaming — bouncing dot animation while the LLM generates; emerald checkmark on completion
- BGE-M3 load indicator — amber pulsing dot on the Multilingual RAG item until the model finishes pre-loading on startup
- Horizontal eval score bars — color-coded fills (green ≥ 7, amber ≥ 4, red < 4) with average badge
| Layer | Choice |
|---|---|
| LLM | Meta Llama meta-llama/llama-4-scout-17b-16e-instruct via langchain-groq (vision + text) |
| Embeddings (general) | all-MiniLM-L6-v2 via langchain-huggingface (384-dim, local, no API key) |
| Embeddings (multilingual) | BAAI/bge-m3 via sentence-transformers (1024-dim, pre-loaded on startup in background thread) |
| Vector DB | ChromaDB PersistentClient — persists to ./chroma_db across restarts |
| Sparse Search | rank-bm25 — BM25Okapi |
| Re-ranking | cross-encoder/ms-marco-MiniLM-L-6-v2 via sentence-transformers |
| Knowledge Graph | NetworkX (in-memory, serialised to chroma_db/graph_rag.json) + PyVis (interactive visualisation) |
| Agentic Workflows | LangGraph — Agentic RAG and CRAG state machines |
| Web Search Fallback | DuckDuckGo (duckduckgo-search) — no API key required |
| Structured Data | pandas + openpyxl — CSV/Excel Text-to-Pandas |
| Adaptive Storage | SQLite via adaptive_db.py — feedback, semantic cache, analytics |
| Document Parsing | PyPDF2, python-docx, pandas (CSV/Excel), Pillow (images) |
| Backend API | FastAPI + Uvicorn, SSE streaming via threading.Queue |
| Frontend | Next.js 14, React 18, Tailwind CSS, TypeScript |
| Containerisation | Docker + Docker Compose (backend + frontend + persistent volumes) |
| Python | 3.11+ |
rag-studio/
│
├── requirements.txt
├── Dockerfile # FastAPI backend Docker image
├── docker-compose.yml # backend + frontend + chroma_data + adaptive_data volumes
├── .env # GROQ_API_KEY (gitignored)
├── .env.example # Template — copy to .env and fill in
├── adaptive_data/
│ └── adaptive.db # SQLite — feedback, semantic cache, analytics (auto-created)
├── chroma_db/ # Persistent ChromaDB vector store (auto-created, gitignored)
│ └── graph_rag.json # Graph RAG knowledge graph (serialised on every ingest)
│
├── core/
│ ├── shared_services.py # LLM (ChatGroq), embeddings (MiniLM + BGE-M3), PersistentChromaDB,
│ │ # reranker, parent-child chunking, build_sourced_context,
│ │ # evaluate_context, web_search_fallback,
│ │ # chroma_query() — HNSW-safe retry + rebuild wrapper
│ └── adaptive_db.py # AdaptiveDB — feedback boost/unmark, semantic cache, analytics
│
├── architectures/
│ ├── hybrid_rag.py # Dense + BM25 + RRF + cross-encoder + feedback boost
│ ├── graph_rag.py # Entity extraction → NetworkX graph + feedback boost
│ ├── agentic_rag.py # LangGraph: Planner → Tool Executor → Reasoner + multi-hop
│ ├── corrective_rag.py # LangGraph: Retrieve → Evaluate → Route → Generate
│ ├── multimodal_rag.py # Llama 4 Scout vision + base64 image metadata
│ ├── multilingual_rag.py # BGE-M3 cross-lingual embeddings + cross-encoder + feedback boost
│ ├── rag_fusion.py # 4 sub-queries + RRF + feedback boost
│ ├── hyde_rag.py # Hypothetical document embeddings + feedback boost
│ ├── structured_rag.py # Text-to-Pandas (CSV/Excel) + vector fallback
│ └── self_rag.py # [IsRel] / [IsSup] / [IsUse] critique loop — max 2 iterations
│
├── backend/
│ ├── __init__.py
│ ├── session_manager.py # GlobalSession — initialises all 10 pipelines + ARCH_INFO
│ └── api.py # FastAPI — 17 endpoints, SSE streaming, RAGAS eval
│
├── legacy/
│ └── app.py # Original Streamlit prototype (reference only)
│
└── frontend/
├── Dockerfile # Next.js multi-stage Docker image
├── app/
│ ├── layout.tsx
│ ├── page.tsx # Root — all state, streaming, feedback, analytics, exports
│ └── globals.css # CSS variables, glass utilities, prose styles, animations
├── components/
│ ├── Sidebar.tsx # Compact arch list (all 10 without scroll), toggles,
│ │ # document manager slot, history, pinned action grid
│ ├── ArchCard.tsx # Full-width architecture header — gradient wash, glow icon,
│ │ # tech-stack tags, Active chip, How it works + Knowledge Graph buttons,
│ │ # expandable How it works / Best for panel
│ ├── ChatMessage.tsx # Chat bubbles with thumbs feedback (toggle to unmark) + ⚡ cached badge
│ ├── MarkdownContent.tsx # Inline markdown renderer
│ ├── BrainWorking.tsx # Live step indicators + bouncing dots + emerald done state
│ ├── SourcePanel.tsx # Collapsible source citations with chunk counts and scores
│ ├── EvalScorecard.tsx # Horizontal score bars: Faithfulness / Relevance / Precision / Recall
│ ├── DocumentManager.tsx # Drag-drop upload + URL ingestion + per-file delete
│ ├── ApiKeyModal.tsx # Groq API key modal — auto-opens if no key set
│ ├── CompareGrid.tsx # 10-card grid with ping-ring loading + expand modal
│ ├── AnalyticsDashboard.tsx # Per-arch stats table with bar charts + recent queries
│ └── ArchExplainer.tsx # Pipeline flow, how-it-works, adaptive features per arch
├── tailwind.config.ts # Custom tokens: surface colors, glow shadows, animations
└── lib/
├── api.ts # All API calls + EventSource streamQuery()
└── types.ts # TypeScript interfaces
- Python 3.11+
- Node.js 18+ (for the Next.js frontend)
- A free Groq API key
git clone https://github.com/pranay9981/RAG-Studio.git
cd RAG-Studio
python -m venv venv
# Windows
venv\Scripts\activate
# macOS / Linux
source venv/bin/activate
pip install -r requirements.txtCopy the example env file and add your Groq key:
cp .env.example .envEdit .env:
GROQ_API_KEY=gsk_your-groq-api-key-here
Get a free key at console.groq.com/keys.
Alternatively, leave.envempty and enter the key in the UI on first launch.
Terminal 1 — FastAPI backend
python -m uvicorn backend.api:app --host 127.0.0.1 --port 8000 --reloadTerminal 2 — Next.js frontend
cd frontend
npm install # first time only
npm run devOpen http://localhost:3000.
Note: On first startup the BGE-M3 multilingual model (~570 MB) downloads and loads in a background thread. The Multilingual RAG item in the sidebar shows an amber pulse dot until it's ready — all other architectures are immediately usable.
cp .env.example .env # add GROQ_API_KEY to .env first
docker compose up --buildBoth services start automatically. ChromaDB and SQLite data persist in named Docker volumes.
- Upload documents — drag-drop one or more files (PDF, DOCX, TXT, CSV, XLSX, PNG, JPG) or paste a URL. All formats are ingested into all 10 architectures automatically.
- Ask questions — press Enter to send; watch the brain-working panel stream live pipeline steps and tokens in real time.
- Compare mode — toggle "Compare All (10)" to run every architecture simultaneously; results appear in a card grid with per-card expand modal.
- Multi-document queries — upload multiple files then ask comparison questions like "What are the differences between document A and document B?" — each chunk is labelled with its source filename.
- RAG Evaluation — toggle "RAG Evaluation" to get RAGAS-inspired scores after each answer (Faithfulness, Relevance, Context Precision, Context Recall).
- Thumbs feedback — rate any answer up or down; click the active button again to unmark. The system surfaces positively-rated chunks first in future queries.
- Export — click "Export" in the sidebar action grid to download the current chat, all architecture chats, or compare results as
.mdfiles. - Clear Cache — click "Cache" in the sidebar to wipe the semantic query cache; forces all architectures to re-run their full retrieval pipelines.
- Stats — click "Stats" in the sidebar to see per-architecture analytics: query counts, latencies, eval scores, cache hits, and feedback ratios.
- How it works — click "How it works" in the header for a detailed explainer of the current architecture's pipeline.
- Knowledge Graph — when Graph RAG is active and a document has been ingested, click "Knowledge Graph" in the header to explore the extracted entity-relationship graph interactively.
- Document management — view and delete ingested files from the sidebar Documents panel.
- API Key — click the "API Key" button in the sidebar to update your Groq key at any time without restarting the server.
| Method | Path | Description |
|---|---|---|
GET |
/api/health |
Health check — includes bge_m3_loaded flag |
GET |
/api/architectures |
All 10 architecture metadata |
GET |
/api/sessions/{id} |
Session info, ingested archs, doc library |
POST |
/api/ingest |
File or URL ingest with parent-child chunking |
GET |
/api/query |
SSE stream — step / token / sources / done / error events |
POST |
/api/compare |
Run all 10 architectures concurrently (150ms stagger, HNSW-safe) |
POST |
/api/evaluate |
RAGAS-inspired 4-metric scoring |
POST |
/api/feedback |
Store rating (1 = up, −1 = down, 0 = unmark/delete) |
GET |
/api/analytics |
Per-architecture aggregated stats from SQLite |
GET |
/api/graph |
PyVis HTML for Graph RAG knowledge graph visualisation |
GET |
/api/history |
Last 20 queries |
DELETE |
/api/sessions/{id} |
Reset all pipelines and session history |
GET |
/api/documents |
List ingested files + chunk counts for an architecture |
DELETE |
/api/documents |
Delete a file from all architectures |
DELETE |
/api/cache |
Clear the semantic query cache |
GET |
/api/config/status |
Returns {has_key: bool} — whether GROQ_API_KEY is set |
POST |
/api/config/apikey |
Set Groq API key at runtime and re-initialise LLM |
Query
│
├─► Semantic Cache (cosine sim ≥ 0.95 + length-ratio guard) ──► ⚡ Instant cached answer
│
▼
Retrieve chunks
│
├─► Feedback Boost — positively-rated chunks move up, negative move down
│
▼
Self-Evaluation (evaluate_context)
├─► CORRECT ──────────────────► Generate answer
├─► AMBIGUOUS ─► + web search ──► Generate answer (CRAG: always generate, no web)
└─► INCORRECT ─► web search ────► Generate answer (Graph RAG: always use ingested docs)
│
▼
Store in semantic cache + analytics
All 10 architectures use services.chroma_query() — a thread-safe wrapper around ChromaDB's collection.query() that retries up to 3× on HNSW segment reader failures (common under concurrent compare-mode load), refreshing the collection handle between attempts. If all retries fail it falls back to a full HNSW rebuild by re-embedding stored documents from SQLite. Never call collection.query() directly in new architectures.
MIT