AI-powered chatbot for Ministry of Finance, Planning and Economic Development (MoFPED) Uganda
# MoFPED Chatbot
A modern Retrieval-Augmented Generation (RAG) chatbot for the Ministry of Finance, Planning and Economic Development (MoFPED) website. This chatbot provides intelligent answers to public queries using content from finance.go.ug and approved sub-domains.
## Features
- **Intent-Based Routing**: Intelligent classification of user queries into four categories:
- 📍 **Location/Directions** - Office addresses and directions
- 📞 **Contact Information** - Phone numbers, emails, and support details
- 🔧 **Service How-To** - Application processes and requirements
- 📄 **Document Lookup** - Policies, forms, and official documents
- **Source Priority System**:
- Primary: Official finance.go.ug website
- Secondary: Government directories (gov.ug)
- Tertiary: Internal document database (RAG)
- **Web Scraping**: Real-time information from official government websites
- **Modern Chat Interface**: Responsive, MoFPED-branded chatbot widget
- **Document Discovery**: Intelligent search and categorization of MoFPED documents
- **Supabase Integration**: Vector search with pgvector for semantic matching
- **Metadata-Based Search**: Focus on document titles, descriptions, and categories
- **Source Linking**: Direct links to authoritative source documents
- **Zero Hallucination**: No content generation, only document discovery and linking
## Tech Stack
- **Frontend**: Next.js 15, React 19, TypeScript, Tailwind CSS 4
- **Backend**: Next.js API Routes, Supabase (PostgreSQL + pgvector)
- **AI/ML**: OpenAI GPT-4 Turbo, text-embedding-3-small
- **RAG**: LangChain 0.3.30, custom hybrid search
- **Database**: Supabase with pgvector extension
- **Styling**: Lucide React icons, custom MoFPED branding
## Getting Started
### Prerequisites
- Node.js 18+
- npm or yarn
- Supabase account with pgvector enabled
- OpenAI API key
### Installation
1. **Clone the repository**
```bash
git clone
cd mofped-chatbot
```
2. **Install dependencies**
```bash
npm install
```
3. **Set up enviro …