A Retrieval-Augmented Generation (RAG) bot that answers questions from a PDF FAQ document using Hugging Face models. This bot is available via both Gradio Web UI and a Discord Bot.
- 🌐 Web App (Gradio): https://4d261da699ca0b7580.gradio.live)
- 💬 Discord Bot Server: Join Discord Server)
- Upload a PDF and ask questions about its content
- Supports both Web and Discord interfaces
- Powered by Hugging Face Embeddings
- Uses FAISS for vector storage & fast retrieval
- Fully customizable with LangChain modules
langchainlangchain_communitylangchain_huggingfacetransformersdiscord.pygradiopython-dotenvPyMuPDF(PDF parsing)faiss-cpu
sentence-transformers/all-MiniLM-L6-v2(for embeddings)
rag-discord-bot/ ├── .env # Environment variables (API keys) ├── data/ │ └── faq.pdf # Input document ├── ingest.py # PDF → Chunk → Embeddings → FAISS ├── rag_query.py # Local CLI interface ├── rag_web.py # Gradio Web Interface ├── discord_bot.py # Discord Bot handler ├── vectorstore/ │ ├── index.faiss │ └── index.pkl ├── requirements.txt
yaml Copy Edit
env
HUGGINGFACEHUB_API_TOKEN=your_huggingface_token
DISCORD_TOKEN=your_discord_bot_token
⚙️ Setup Instructions
- Clone & Create Virtual Environment bash Copy Edit git clone (https://github.com/babucmb/Discord-Rag-Chatbot) cd Discord-Rag-Chatbot
python -m venv .venv ..venv\Scripts\activate # Windows 2. Install Dependencies bash Copy Edit pip install -r requirements.txt 3. Ingest Document bash Copy Edit python ingest.py 4. Test Locally (CLI) bash Copy Edit python rag_query.py 5. Launch Web App bash Copy Edit python rag_web.py 6. Start Discord Bot bash Copy Edit python discord_bot.py
--- ☁️ Deployment Notes Hosting 24/7 You can deploy this on:
Hugging Face Spaces (Web Only)
Railway.app
Render.com
🛠 Recommended Tools Use .gitignore to exclude .env and vectorstore/
For Discord bot hosting, use a VM or service that supports persistent Python background tasks