AI-powered agricultural advisory platform for smallholder farmers in Lesotho. Delivers bilingual (English + Sesotho) guidance on planting, pest control, and weather-aware decisions using a local quantized LLM and RAG - offline-first, with SMS alerts and a React PWA frontend.
# Mosupisi - AI-Powered Agricultural Extension Platform
**Mosupisi** (Sesotho for "guide" or "one who shows the way") is an AI-powered agricultural advisory platform designed specifically for smallholder farmers and extension officers in **Lesotho**. It delivers practical, bilingual (English + Sesotho) guidance on planting, pest control, weather-aware decisions, and general farming queries using a **local quantized LLM** and **Retrieval-Augmented Generation (RAG)**.
- **Offline-first**: works in low-connectivity rural areas with data synchronisation when connectivity is restored.
- **Locally grounded**: RAG knowledge base built from official Lesotho Meteorological Services (LMS) Agrometeorological Bulletins (2010-2026).
- **Bilingual**: full English and Sesotho interface with on-the-fly translation of AI advice.
- **Proactive alerts**: weather hazards, crop milestones, pest risks, and spray windows via SMS and push notifications.
---
## Table of Contents
- Architecture Overview
- Model Training
- Services & Ports
- Prerequisites
- Getting Started
- 1. Clone the Repository
- 2. Environment Variables
- 3. Model Placement (Critical)
- 4. Install Dependencies
- Running Mosupisi
- Option A: Automated Scripts (Recommended)
- Option B: Manual Start (Order matters)
- Health Checks
- Using the Platform
- Troubleshooting
- Next Steps & Future Work
---
## Architecture Overview
Mosupisi follows a **microservices architecture** with independent, loosely coupled services. A central **LLM service** loads the quantised Mistral model (`mosupisi-q4.gguf`) and serves all other modules. RAG retrieval is performed via ChromaDB using sentence-transformer embeddings (`all-MiniLM-L6-v2`).
### How the System Fits Together
At the centre of the platform is the **LLM Service** (port 3004), which loads the quantised Mistral model (`mosupisi-q4.gguf`) and exposes a single `/infer` endpoint. Every other backend service that needs AI-generated text calls this endpoint - none of them lo …