The Council Query Assistant is a Retrieval-Augmented Generation (RAG) system built to serve Masvingo City Council and its residents. It enables users to ask natural language questions about council operations and receive accurate, document-grounded answers. The system ingests structured civic dataβsuch as by-laws, licensing procedures, water distribution, and public noticesβand uses semantic search to retrieve relevant content before generating responses with a language model. A lightweight Flask frontend allows users to interact with the assistant via a clean web interface, making the system accessible to non-technical users and deployable in local government environments.
The assistant follows a modular RAG pipeline:
Document Loading Civic .txt files are loaded from the data/ directory. These files contain quantized information tailored to Masvingo City Council.
Text Chunking Each document is split into semantically coherent chunks to improve retrieval granularity.
Embedding and Storage Chunks are embedded using a transformer-based model and stored in a vector database (ChromaDB) for fast similarity search.
Similarity Search User queries are matched against stored vectors to retrieve the most relevant chunks.
Answer Generation Retrieved context is passed to a language model (e.g. Groq or OpenAI) which generates grounded responses.
Flask Frontend A minimal Flask app serves as the user interface. It includes:
A query input field
Display of retrieved answers
Optional debug view for retrieved chunks This frontend simplifies deployment and testing, and can be extended with authentication or mobile responsiveness.
The system successfully answers multi-turn civic queries with high contextual relevance. It supports:
Licensing workflows based on official council forms
Bill payment guidance using verified platforms
Retrieval of ward councillor contacts
Interpretation of statutory by-laws
Access to health services and digital records
The Flask frontend enables real-time interaction and makes the assistant usable by council staff and residents. Initial testing shows strong alignment between user questions and retrieved content, with minimal hallucination. The assistant improves civic engagement by making council information searchable, conversational, and accessible.
Welcome Screen β Masvingo RAG Assistant
Query Example β Water Billing and Payments
System Prompt and Query Response