Build your own domain-specific chatbot — offline, modular, and blazing fast.
The Universal Offline AI Chatbot is a privacy-respecting, offline-ready assistant that can chat over any set of PDFs. It’s ideal for legal, cybersecurity, academic, enterprise, or technical domains.
It uses a locally hosted LLM (mistral:instruct via Ollama) and semantic search powered by HuggingFace embeddings and FAISS. You get fast, accurate responses, without sending anything to the cloud.
GitHub Link: https://github.com/AdityaBhatt3010/Universal-Offline-AI-Chatbot
DockerHub Link: https://hub.docker.com/r/adityabhatt3010/ai-chatbot
- 🔐 Fully offline-capable with local LLM (via Ollama)
- 📄 Works out-of-the-box with your PDFs
- 🧠 Semantic vector search using
all-MiniLM-L6-v2 - ⚡️ Fast and responsive using FAISS backend
- 🧩 Modular, extendable architecture (Streamlit frontend + CLI)
- 🐳 Docker-ready for deployment
- 📸 UI Preview with screenshots
- ✅ Built-in CI/CD check via GitHub Actions
- 🎯 Fully reproducible setup via PowerShell script or Docker
| Layer | Stack |
|---|---|
| LLM | mistral:instruct via Ollama |
| Embeddings | all-MiniLM-L6-v2 via SentenceTransformers |
| Vector Store | FAISS (in-memory + disk) |
| Framework | LangChain (v0.2+) |
| Language | Python 3.11+ |
| UI | Streamlit |
| Container | Docker |
| CI/CD | GitHub Actions (.github/workflows/python.yml) |
⚠️ HuggingFace Token is required to fetch the embedding model once. It's cached locally afterward.
Example .env:
HF_TOKEN=your_huggingface_token_here| Chatbot Type | Add These PDFs |
|---|---|
| 👨⚖️ LawyerBot | Legal, Constitution, HR documents |
| 🧬 ResearchBot | Whitepapers, scientific papers |
| 🛡️ CyberSecBot | SOC2, GDPR, ISO27001, NIST docs |
| 📚 EdTechBot | Notes, textbooks, question banks |
| 🧑💼 HR/CompanyBot | SOPs, onboarding docs, HR policies |
Universal-Offline-AI-Chatbot/
│
├── data/ # Place your PDF documents here
│ └── Try.pdf
│
├── Screenshots/ # UI snapshots
│ ├── Loading_Screen.png
│ └── Running_the_Model.png
│
├── src/ # Modular source code
│ ├── chunker.py
│ ├── config.py
│ ├── embedding.py
│ ├── loader.py
│ ├── model_loader.py
│ ├── prompts.py
│ ├── qa_chain.py
│ ├── utils.py
│ └── vectorstore.py
│
├── vectorstore/ # Local FAISS vector index
│ └── db_faiss/
│
├── Bot.py # CLI script
├── Bot.ipynb # Jupyter notebook version
├── main.py # Entry-point (optional)
├── streamlit_app.py # Frontend UI (Streamlit)
├── requirements.txt # Python dependencies
├── setup.ps1 # PowerShell setup script
├── Dockerfile # Docker image definition
├── .dockerignore
├── setup.py # PyPI config
├── pyproject.toml # Modern packaging metadata
├── MANIFEST.in # Source packaging rules
├── .env # Contains HF_TOKEN
├── README.md
└── LICENSE
.\setup.ps1This will:
- Create virtual env
- Install dependencies
- Pull Mistral via Ollama
- Ask for Hugging Face token
- Build Docker image
- Install Python Requirements
pip install -r requirements.txt- Install & Pull Ollama Model
ollama pull mistral:instruct- Set HuggingFace Token (First Time Only)
export HUGGINGFACEHUB_API_TOKEN=your_token # macOS/Linux
set HUGGINGFACEHUB_API_TOKEN=your_token # Windows CMD- Run the CLI Bot
python Bot.pypip install universal-offline-ai-chatbotAfter installation, you can launch the CLI like this:
universal-offline-ai-chatbotThis runs the
main.pyCLI bundled in the PyPI package.
streamlit run streamlit_app.py- Docker installed & running
.envfile containingHF_TOKEN(Hugging Face token)
To build and run the chatbot using Docker, follow these steps:
-
Build the Docker image:
docker build -t ai-chatbot . -
Run the container (with volume mount and token):
docker run -p 8501:8501 --env-file .env -v ${PWD}/data:/app/data ai-chatbotThis will:
- Map the container's port
8501to local8501 - Use your local
.envforHF_TOKEN - Mount the
data/folder into the container for access to PDFs
- Map the container's port
Access the chatbot at http://localhost:8501
# Replace default file(s)
mv your_files/*.pdf ./data/
# Re-run the bot or restart Streamlit
python Bot.pyAutomatically re-indexes your new documents using FAISS.
🧠 You: What does Article 21 state?
🤖 Bot: Article 21 of the Indian Constitution guarantees the protection of life and personal liberty...
Aditya Bhatt
Cybersecurity Specialist | VAPT Expert | OSS Contributor
GitHub | Medium



