Logo Lanfrica

GilbertoBotas/Mozambican-Road-Code-Chatbot-RAG

Domain:

digital infrastructure

Record type:

software
Creator:
Gil
Host:
RAG-powered assistant for the Mozambique Road Code. Ask questions about traffic rules, penalties, and safe driving in Portuguese. Access via console or REST API. # Mozambique Road Code RAG Assistant A Retrieval-Augmented Generation (RAG) powered assistant that helps drivers, students, and citizens understand the Mozambique Road Code (Código de Estrada). This project uses Google Gemini AI to provide accurate, context-based answers about traffic rules, road signals, driver duties, penalties, and safe driving practices. ## 📋 Project Overview This project implements a conversational AI assistant specialized in the Mozambique Road Code. It combines: - **RAG (Retrieval-Augmented Generation)**: Retrieves relevant information from Road Code documents - **Vector Database**: Uses Chroma for efficient document storage and retrieval - **Large Language Model**: Powered by Google Gemini for intelligent responses - **Structured Output**: Returns answers in a standardized format with articles and follow-up questions - **FastAPI Backend**: Provides a REST API endpoint for integration - **Console Interface**: Interactive command-line interface for direct interaction ## 🎯 Features - **Article References**: Automatically identifies and references relevant Road Code articles - **Follow-up Questions**: Suggests related questions for deeper learning - **Educational Focus**: Explains rules clearly like a driving instructor or traffic officer - **Dual Interface**: Access via REST API or interactive console ## ⚙️ Requirements - **Python 3.12 or higher** - **Google API Key** (for Gemini embeddings and LLM) - **Internet Connection** (for API calls and document embedding) ## 🚀 Installation ### Step 1: Clone or Download the Project ```bash cd your-project-directory ``` ### Step 2: Create a Virtual Environment (Recommended) ```bash python -m venv venv ``` Activate the virtual environment: - **On Windows:** ```bash .venv\Scripts\activate ``` - **On macOS/Linux:** ```bash source venv/bin/activate ``` ### Step 3: Install Dependencies Install all required packages from `requirements.txt`: ```bash pip install -r requirements.txt ``` ### Ste …