Health-Chatbot in Nigeria Languages
# Nigerian Health Chatbot
## 1) Requirements
* **Python** 3.10+
* **PostgreSQL** running locally (or your own DB connection string)
* \~**3 GB disk** free for the NLLB-200 model on first run
* An OpenAI API key
```bash
# (Recommended) create and activate a virtualenv
python -m venv .venv
# Windows (PowerShell):
. .venv\Scripts\Activate.ps1
# macOS/Linux:
source .venv/bin/activate
```
Install dependencies:
```bash
pip install --upgrade pip
pip install streamlit python-dotenv openai chromadb \
langchain-community langchain-openai \
transformers sentencepiece pypdf pymupdf trafilatura \
sqlalchemy psycopg2-binary requests
```
> If you have a GPU and PyTorch installed, the NLLB model will use it automatically; otherwise it will run on CPU.
---
## 2) Project structure
```
.
├── app.py # Streamlit chat app
├── ingest_health_docs.py # Ingests Nigerian health docs into Chroma
├── .env # Environment variables (create this)
├── data/
│ └── raw/ # Place PDFs/HTML/txt here (or use seed URLs)
└── health-knowledge-chroma/ # Auto-created Chroma DB (or your custom dir)
```
---
## 3) Environment variables (`.env`)
Create a file named `.env` in the project root:
```ini
# OpenAI
OPENAI_API_KEY=sk-xxx
# Chroma persistent directory (created automatically)
HEALTH_DB_DIR=health-knowledge-chroma
# PostgreSQL for chat history (adjust to your setup)
DATABASE_URL=postgresql://postgres:YOURPASSWORD@localhost:5432/healthbot
# Optional: Bing Web Search key (only used for GPT fallback snippets)
# BING_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxx
```
---
## 4) Get Nigerian health documents (optional but recommended)
Create folders:
**PowerShell (Windows)**
```powershell
mkdir data\raw -Force
```
**bash/macOS/Linux**
```bash
mkdir -p data/raw
```
Download a starter pack (choose your shell):
**Windows PowerShell (use `curl.exe`)**
` …