# π€ Kinyarwanda-Speaking Chatbot for Sexual and Reproductive Health (SRH)
This is a prototype **RAG-based chatbot** designed to provide accurate, culturally relevant information on **Sexual and Reproductive Health (SRH)** in **Kinyarwanda**, integrated with **WhatsApp via Twilio**.
Built using **LangChain**, **OpenAI's GPT-4o-mini**, and **FAISS vectorstore**, this project demonstrates how Retrieval-Augmented Generation can be applied to real-world public health challenges in low-resource languages.
---
## π Project Goals
- π² Improve access to reliable SRH information in Kinyarwanda
- π¬ Support WhatsApp-based queries via conversational AI
- π§ Recommend family planning options based on user context (via prediction model)
- π Demonstrate use of RAG in a low-resource language and testing environment
---
## βοΈ Tech Stack
- **Flask** β Web framework for the chatbot API
- **LangChain** β For RAG pipeline and conversation memory
- **OpenAI GPT-4o-mini** β LLM for generation
- **FAISS** β Vector store for document retrieval
- **Twilio API** β For WhatsApp message integration
- **PyMuPDF, PowerPoint & Text Loaders** β For loading SRH content
- **Ngrok** β To expose local Flask server for Twilio testing
- **dotenv** β For API key management
---
## π¦ Features
- β
Chatbot supports **Kinyarwanda SRH content**
- β
Uses **RAG** to respond with domain-specific answers
- β
Runs in **Twilio Sandbox** (test environment)
- β
Handles multiple user sessions with conversation history
- β
Real-time chat through WhatsApp interface
- β
Flask-based server runs with background thread & ngrok tunneling
---
## π οΈ How It Works
1. **Load SRH documents** (PDF, PPTX, TXT) from local directory
2. **Split content** into chunks and store embeddings in **FAISS vectorstore**
3. Create **retriever** for document search
4. Initialize **ChatOpenAI** model (GPT-4o-mini) and conversation memory
5. User sends a message on WhatsApp β handled via Flask route `/bot`
6. Twilio webhook receives the me β¦