An AI chatbot that allows users to upload documents and ask questions using Retrieval-Augmented Generation (RAG) powered by Google Gemini Pro. Features user authentication, document processing, and intelligent query suggestions.
- Document Support: PDF, TXT, DOCX, PPTX, Markdown, HTML files (up to 16MB)
- Vector Search: FAISS-powered similarity search for content retrieval
- AI Responses: Google Gemini Pro generates contextual answers
- Chat History: Persistent conversation storage
- User Authentication: Secure registration/login with JWT tokens
- Query Suggestions: AI-generated question suggestions
- Analytics: Usage statistics and insights
- Modern UI: Responsive interface with drag-and-drop
- Frontend: HTML5, CSS3, JavaScript
- Backend: Flask (Python)
- Database: SQLite
- Vector DB: FAISS with Sentence Transformers
- LLM: Google Gemini Pro API
- Embeddings: all-MiniLM-L6-v2
RAG/
├── frontend/ # Web interface
├── backend/ # Core logic and APIs
├── data/ # SQLite database
├── uploads/ # User files
├── vectorstore/ # FAISS index
├── app.py # Main Flask app
├── run.py # App runner
└── requirements.txt # Dependencies
- Python 3.8+
- Google AI Studio API key (Get it here)
# Install dependencies
pip install -r requirements.txt
# Configure environment
cp .env.example .env
# Edit .env and add your GOOGLE_API_KEY
# Run application
python app.pyVisit: http://localhost:5000
- Upload: Drag & drop documents (PDF, TXT, DOCX, etc.)
- Ask: Type questions about your documents
- Get Answers: AI responses with source attribution
POST /upload- Upload documentsPOST /ask- Ask questionsPOST /auth/register- User registrationPOST /auth/login- User loginGET /chat/history- Chat historyGET /analytics- Usage analytics
- JWT-based authentication
- bcrypt password hashing
- Input validation and sanitization
- User data isolation
- Guest mode support
Create .env file with:
GOOGLE_API_KEY=your_api_key_here
SECRET_KEY=your_secret_key
FLASK_ENV=development
- API Key Error: Check
.envfile has validGOOGLE_API_KEY - Module Errors: Run
pip install -r requirements.txt - Upload Fails: Check file size (max 16MB) and format support
- Auth Issues: Verify
SECRET_KEYin.env
MIT License
- Google Gemini flash for AI capabilities
- Sentence Transformers for embeddings
- FAISS for vector search
- Flask for web framework
Happy Learning! 🎓
