RathnavelRahul/omni-modal-rag
π Omni-Modal RAG System
<div align="center">
An intelligent document analysis system powered by AI that can process PDFs, images, and audio files to answer your questions.
Live Demo β’ Features β’ Quick Start β’ Architecture
</div>
π Table of Contents
- About
- Features
- Tech Stack
- Architecture
- Quick Start
- Docker Deployment
- API Reference
- Configuration
- Contributing
π― About
Omni-Modal RAG is a Retrieval-Augmented Generation system that enables intelligent document analysis across multiple modalities. Upload documents, images, or audio files, and ask questions in natural language to get accurate, AI-powered answers.
What makes it special?
- Multi-modal support: Process PDFs, images (with OCR), and audio files
- Hybrid search: Combines semantic embeddings + keyword search + knowledge graph
- Real-time streaming: See AI responses as they're generated
- Clean, structured answers: Bullet-point format for easy reading
β¨ Features
π οΈ Tech Stack
Backend
- FastAPI - High-performance async Python API
- LangChain - LLM orchestration
- FAISS - Vector similarity search
- spaCy - NLP and entity extraction
- Tesseract - OCR for images
- Whisper - Audio transcription
- NetworkX - Knowledge graph
Frontend
- Next.js 14 - React framework
- TypeScript - Type-safe JavaScript
- Tailwind CSS - Utility-first styling
- Lucide Icons - Beautiful icons
AI Models
- Qwen2.5-72B-Instruct - LLM for response generation
- all-MiniLM-L6-v2 - Text embeddings
ποΈ Architecture
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Frontend (Next.js) β
β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββββββββββ β
β β Upload β β Chat β β Sidebar β β Message Display β β
β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββββββββββ β
βββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββ
β HTTP/SSE
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Backend (FastAPI) β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β API Routes β β
β β /upload β /chat β /files β /feedback β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β βββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββ β
β β Processing Pipeline β β
β β ββββββββββββ ββββββββββββ ββββββββββββ βββββββββββββ β β
β β β PDF β β Image β β Audio β β Chunking β β β
β β β Extractorβ β OCR β β Whisper β β & Index β β β
β β ββββββββββββ ββββββββββββ ββββββββββββ βββββββββββββ β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β βββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββ β
β β Retrieval System β β
β β ββββββββββββ ββββββββββββ ββββββββββββ βββββββββββββ β β
β β β Vector β β Keyword β βKnowledge β β HyDE β β β
β β β Store β β Search β β Graph β β Generator β β β
β β β (FAISS) β β (BM25) β β(NetworkX)β β β β β
β β ββββββββββββ ββββββββββββ ββββββββββββ βββββββββββββ β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β βββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββ β
β β LLM Integration β β
β β ββββββββββββββββββββββ ββββββββββββββββββββββββββββββ β β
β β β Agent Orchestrator β β HuggingFace API Client β β β
β β β (ReAct Loop) β β (Qwen2.5-72B-Instruct) β β β
β β ββββββββββββββββββββββ ββββββββββββββββββββββββββββββ β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββData Flow
User Query β Hybrid Retrieval β Context Assembly β LLM Generation β Response
β β β β β
"What is X?" Vector+BM25 Top-K chunks Qwen2.5-72B Bullet points
+ Graph Walk + Related + Prompt + Clean formatπ Quick Start
Prerequisites
- Python 3.10+
- Node.js 18+
- Git
- Tesseract OCR (for image processing)
1. Clone the Repository
git clone https://github.com/YOUR_USERNAME/omni-modal-rag.git
cd omni-modal-rag2. Backend Setup
# Navigate to backend
cd backend
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Download spaCy model
python -m spacy download en_core_web_sm
# Create .env file
cp .env.example .env
# Edit .env and add your HUGGINGFACE_API_KEY3. Get HuggingFace API Key
- Go to huggingface.co/settings/tokens
- Create a new token with "Read" permissions
- Copy the token to your
.envfile
4. Frontend Setup
# Navigate to frontend
cd ../frontend
# Install dependencies
npm install5. Run the Application
Terminal 1 - Backend:
cd backend
python -m uvicorn main:app --reload --port 8000Terminal 2 - Frontend:
cd frontend
npm run devOpen http://localhost:3000 in your browser!
π³ Docker Deployment
Manual Deployment
For detailed instructions on pushing to GitHub and deploying to the cloud (Railway/Render), please see our Deployment Guide.
Using Docker Compose (Local)
# Build and run
docker-compose up --build
# Run in background
docker-compose up -dManual Docker Build
# Build backend
docker build -t omni-rag-backend ./backend
# Build frontend
docker build -t omni-rag-frontend ./frontend
# Run containers
docker run -d -p 8000:8000 --env-file .env omni-rag-backend
docker run -d -p 3000:3000 omni-rag-frontendπ‘ API Reference
Upload File
POST /api/upload
Content-Type: multipart/form-data
file: <binary>Chat (Streaming)
POST /api/chat
Content-Type: application/json
{
"message": "What are the key findings?",
"session_id": "optional-session-id"
}List Files
GET /api/filesDelete File
DELETE /api/files/{file_id}βοΈ Configuration
Environment Variables
π Project Structure
omni-modal-rag/
βββ backend/
β βββ agents/ # LLM orchestration
β βββ graph/ # Knowledge graph
β βββ ingestion/ # Document processing
β βββ llm/ # LLM client
β βββ retrieval/ # Search & retrieval
β βββ routes/ # API endpoints
β βββ synthesis/ # Response building
β βββ utils/ # Utilities
β βββ main.py # FastAPI app
β βββ config.py # Configuration
β βββ requirements.txt # Python dependencies
β
βββ frontend/
β βββ app/ # Next.js pages
β βββ components/ # React components
β βββ types/ # TypeScript types
β βββ package.json # Node dependencies
β
βββ docker-compose.yml # Docker orchestration
βββ Dockerfile # Multi-stage build
βββ README.md # This fileπ€ Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π€ Author
Arman Shalik J
- GitHub: @yourusername
- LinkedIn: Arman Shalik J
- Email: shalik.jhs@gmail.com
<div align="center">
β If you found this project helpful, please give it a star! β
</div>
