Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RAGLab

Interactive RAG experimentation lab — compare retrieval strategies and generation modes side-by-side on real documents.

Demo / portfolio project. Run it locally to explore how different RAG pipelines behave.

CI License: MIT


What it does

Pick a document, choose how to chunk/embed/retrieve, pick a RAG mode, and ask questions. Streaming answers plus retrieval insights show how each configuration changes quality.

Area Options
RAG modes Basic · Self-RAG · Agentic RAG · Graph RAG
Retrieval Vector (FAISS) · Hybrid (BM25 + RRF) · Multi-query · Cross-encoder rerank
Chunking Recursive · Fixed · Semantic · Structure-aware
Embeddings OpenAI text-embedding-3-small · Local SentenceTransformer

Also included: knowledge-graph extraction, contextual compression, guided UI walkthrough, and SSE token streaming.


Tech stack

Layer Stack
Backend Python, FastAPI, LangChain, FAISS, NetworkX, BM25
Frontend Next.js, React, TypeScript, Tailwind CSS
Models Gemini (generation) · OpenAI / local (embeddings) · MiniLM (rerank)

Project structure

RAGLab/
├── .github/workflows/ci.yml   # lint, typecheck, build, security
├── Makefile                   # setup / run / test
├── raglab-backend/
│   ├── main.py                # FastAPI app
│   ├── config.py              # env config
│   ├── document_store.py      # load + index documents
│   ├── api/                   # REST + SSE routes
│   ├── chunking/              # text + structure chunkers
│   ├── embeddings/            # embedding providers
│   ├── graph/                 # knowledge graph + graph retrieval
│   ├── ingestion/             # PDF parsing
│   ├── middleware/            # error logging
│   ├── retrieval/             # vector / hybrid / multi-query / rerank
│   ├── services/              # RAG generation + compression
│   ├── documents/             # sample PDFs
│   └── verify_system.py       # import / config smoke check
└── raglab-frontend/
    ├── app/                   # Next.js App Router
    ├── components/            # UI
    └── lib/                   # API client

Quick start

Prerequisites

  • Python 3.11+
  • Node.js 18+
  • OpenAI API key (embeddings)
  • Google Gemini API key (generation)

Setup

git clone https://github.com/guptaom31619-prog/RagLab.git
cd RagLab

make setup

Edit raglab-backend/.env:

OPENAI_API_KEY=sk-...
GEMINI_API_KEY=...

Run

make dev
Service URL
Frontend http://localhost:3000
Backend http://localhost:8000
API docs http://localhost:8000/docs

Verify

make test    # import + config smoke check
make lint    # frontend lint
make build   # frontend production build

Make commands

Command Description
make setup Install deps + create .env
make dev Run backend + frontend
make stop Stop local processes
make test Backend smoke check
make lint / make build Frontend quality checks
make clean Remove __pycache__ / .next
make clean-cache Wipe document + KG caches

API (overview)

Method Endpoint Description
GET /health Health check
GET /documents List sample documents
POST /load-document Index a document with chosen config
POST /ask Full answer
POST /ask-stream SSE streaming answer

Example /ask body:

{
  "question": "What was Microsoft's total revenue?",
  "search_method": "hybrid",
  "use_compression": false,
  "rag_mode": "basic"
}

Interactive docs: /docs when the backend is running.


Environment

Variable Required Description
OPENAI_API_KEY Yes Embeddings
GEMINI_API_KEY Yes Answer generation
NEXT_PUBLIC_API_URL No Frontend → backend URL (default http://localhost:8000)

Never commit .env. Use .env.example as the template.


CI

GitHub Actions runs on every push / PR to main:

  • Backend — Python syntax, structure, requirements check
  • Frontendtsc, ESLint, production build
  • Security — no committed .env / hardcoded API keys

License

MIT — see LICENSE.

About

RAGLab — interactive RAG experimentation demo (retrieval strategies + generation modes)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages