Nigerian Constitution RAG (Retrival-Augumented Generation)
This is the final, comprehensive version of your README.md. It now includes a "Performance Benchmarks" section that highlights the actual metrics from your eval_report.md, making the project look highly data-driven and professional.
------------------------------
## 🇳🇬 Naija Civic Guard: Nigerian Constitution RAG
Empowering citizens with AI-driven, verifiable insights into the Nigerian Constitution.
Naija Civic Guard is a high-precision Retrieval-Augmented Generation (RAG) system. Unlike generic LLMs, this tool is strictly grounded in the Official Gazette of the Nigerian Constitution. It utilizes a Hybrid Retrieval strategy and a rigorous evaluation pipeline to provide reliable legal answers with direct source citations.
------------------------------
## 📊 Performance Benchmarks
We don't guess—we measure. Based on our latest automated evaluation against the evaluation_set.jsonl, the system achieves the following metrics:
| Metric | Value | Description |
|---|---|---|
| Hit Rate (Top-K) | 60% | The correct legal section is retrieved in the top results 6 out of 10 times. |
| Avg Keyword Coverage | 84% | Our responses maintain high legal accuracy by including essential terminology. |
| Mean Reciprocal Rank | 0.45 | Measures how highly the system ranks the specific target Section. |
Continuous testing ensures that updates to the retrieval weights or chunking strategies improve these scores over time.
------------------------------
## 🏗️ Architecture & Pipeline## 1. Hybrid Ingestion (ingest.py)
Our ingestion process is a "legal-aware" pipeline designed for maximum precision:
* Metadata Tagging: Uses Regex to extract and tag chunks with specific Section and Article numbers for granular citations.
* Ensemble Retrieval: Combines Vector Search (ChromaDB) for semantic intent and Keyword Search (BM25) for specific legal terms. This ensures that a query about "Fundamental Rights" finds Section 33 even if the exact wording varies.
## 2. RAG Service (services.py)
The RagServi …