An Intelligent PDF Analysis and Chat System powered by LLM + RAG
A production-ready Retrieval-Augmented Generation (RAG) system with a Flask web interface.
✅ Web Interface - Interactive Flask-based chat UI
✅ Document Upload - Easy PDF upload and processing
✅ Real-time Chat - Ask questions and get AI responses
✅ Semantic Search - Vector similarity matching
✅ Source Tracking - Shows document sources
✅ Database Management - Clear and manage documents
✅ Docker Ready - Production deployment
✅ Modular Architecture - Clean, extensible codebase
git clone https://github.com/askchandan/Project-Lexora.git
cd Project-Lexorapython -m venv venv
# Windows: venv\Scripts\activate
# macOS/Linux: source venv/bin/activate
pip install -r requirements.txtOPENAI_API_KEY=your_api_key
OPENAI_API_BASE=https://openrouter.ai/api/v1
DATA_PATH=data
CHROMA_PATH=chroma_db
MODEL_NAME=mistralai/mistral-7b-instructpython app.pyVisit http://localhost:5000
docker build -t project-lexora .
docker run -p 5000:5000 \
-e OPENAI_API_KEY=your_key \
-e OPENAI_API_BASE=https://openrouter.ai/api/v1 \
-v lexora_data:/app/chroma_db \
project-lexora# Update .env with your API key
docker-compose up -d
docker-compose logs -f
docker-compose downVisit http://localhost:5000
- Click "Upload PDF" button
- Select PDF file
- Click "Upload"
- Wait for success message
- Type question in input box
- Click "Send" or press Enter
- View AI response with sources
- Click "Clear Database"
- Confirm action
- Database resets
| Method | Endpoint | Description |
|---|---|---|
| GET | / |
Web interface |
| GET | /status |
System status |
| POST | /upload |
Upload PDF |
| POST | /query |
Ask question |
| POST | /clear |
Clear database |
project-lexora/
├── app.py # Flask application
├── requirements.txt # Dependencies
├── Dockerfile # Docker image
├── docker-compose.yml # Compose config
├── .env.example # Env template
├── README.md # This file
├── LICENSE # MIT License
│
├── src/
│ ├── core/ # RAG pipeline
│ ├── models/ # LLM & Embeddings
│ ├── database/ # Vector store
│ └── utils/ # Config & logging
│
├── templates/
│ └── index.html # Web UI
│
├── static/
│ ├── script.js # Frontend logic
│ └── style.css # Styling
│
├── data/ # PDF storage
└── chroma_db/ # Vector database
# Required
OPENAI_API_KEY=sk_...
OPENAI_API_BASE=https://openrouter.ai/api/v1
# Optional
DATA_PATH=data
CHROMA_PATH=chroma_db
MODEL_NAME=mistralai/mistral-7b-instruct
TEMPERATURE=0.7
MAX_TOKENS=500mistralai/mistral-7b-instruct(default)gpt-3.5-turbogpt-4- Other OpenRouter models
Local
- Python 3.8+
- 2GB RAM
- 500MB disk
Docker
- Docker 20.10+
- Docker Compose 1.29+
- 2GB RAM
- 500MB disk
| Problem | Solution |
|---|---|
| No documents | Upload PDFs via UI |
| API error | Check .env with valid key |
| Port in use | Use different port |
| Slow response | Check API rate limits |
- PDF Processing: ~100ms per document
- Query Response: 2-5 seconds
- Search Speed: <50ms
✅ API keys in .env (gitignored)
✅ Input validation
✅ Secure storage
✅ CSRF protection ready
- Backend: Flask, LangChain, Chroma
- Frontend: HTML5, CSS3, JavaScript
- DevOps: Docker, Docker Compose
- AI: Mistral-7B via OpenRouter
- Fork repository
- Create feature branch
- Make changes
- Submit pull request
MIT License - see LICENSE file
Chandan Malakar
GitHub: @askchandan
Project Lexora - Intelligent RAG Chatbot
Powered by LangChain, Flask, and Chroma