A Hybrid RAG application for asking questions across your documents.
RAGForge combines vector search + BM25 keyword search + reranking + LLM generation to produce grounded answers with source information.
- 📄 PDF, DOCX and TXT document support
- 🧩 Section-aware document chunking
- 🔢 Sentence Transformer embeddings
- 🗄️ ChromaDB vector search
- 🔎 BM25 keyword retrieval
- 🔀 Reciprocal Rank Fusion (RRF)
- 🎯 Cross-encoder reranking
- 🤖 Ox Alpha through OpenRouter
- 📚 Source-aware answers with page metadata
- ⚡ FastAPI backend
- ⚛️ React + Vite frontend
- 🌙 Dark developer-focused UI
Document
│
▼
Document Loader
│
▼
Chunker
│
┌─────────┴─────────┐
▼ ▼
Embeddings BM25
│ │
▼ ▼
ChromaDB Keyword Search
│ │
└─────────┬─────────┘
▼
Hybrid Retrieval
│
▼
RRF
│
▼
Cross-Encoder
Reranking
│
▼
Ox Alpha
│
▼
Answer + Sources
- Python
- FastAPI
- ChromaDB
- Sentence Transformers
- Rank-BM25
- Cross-Encoder
- OpenRouter
- React
- Vite
- Axios
RAGForge/
├── backend/
│ ├── app/
│ │ ├── api/
│ │ └── rag/
│ ├── uploads/
│ ├── .env
│ └── requirements.txt
│
├── frontend/
│ ├── src/
│ ├── package.json
│ └── vite.config.js
│
├── .gitignore
└── README.md
git clone https://github.com/YOUR_USERNAME/RAGForge.git
cd RAGForgecd backend
py -m pip install -r requirements.txtCreate backend/.env:
OPENROUTER_API_KEY=your_openrouter_api_key
MODEL=stealth/ox-alphaStart FastAPI:
py -m uvicorn app.main:app --reloadBackend:
http://127.0.0.1:8000
API docs:
http://127.0.0.1:8000/docs
Open another terminal:
cd frontend
npm install
npm run devOpen:
http://localhost:5173
| Format | Support |
|---|---|
| ✅ | |
| DOCX | ✅ |
| TXT | ✅ |
| Scanned PDF |
RAGForge uses two retrieval strategies:
Vector Search
Finds documents based on semantic meaning using embeddings.
BM25
Finds documents based on keyword relevance.
The results are combined using Reciprocal Rank Fusion (RRF) and then passed through a cross-encoder reranker before generation.
This helps balance semantic similarity with exact keyword matching.
The final context is sent to Ox Alpha through OpenRouter.
The model is instructed to:
- Answer only from retrieved context
- Avoid inventing information
- Cite relevant sources
- Say when the answer cannot be found
Never commit your API key.
OPENROUTER_API_KEY=your_key
MODEL=stealth/ox-alpha.env is included in .gitignore.
- Scanned/image-only PDFs require OCR
- Document management is currently basic
- Free LLM endpoints may be rate-limited
- No authentication system yet
- Multi-document management
- Document-specific querying
- PDF viewer with clickable page citations
- OCR support
- Chat history
- Streaming responses
- LLM fallback model
- Improved document management
- Production deployment
MIT License