Logo Lanfrica

deji445/ai_10022300187

Domaine:

socioeconomic

Type de record:

software
Créateur:
dej
Hôte:
A Retrieval-Augmented Generation (RAG) AI assistant for analyzing Ghana election results and budget data using hybrid retrieval and domain-specific scoring. # 📊 RAG-Based AI Assistant for Ghana Election & Budget Analysis ## Project Overview This project implements a **Retrieval-Augmented Generation (RAG) AI assistant** that answers questions based on: * Ghana Election Results (CSV) * 2025 Budget Statement (PDF) The system retrieves relevant data and uses a Large Language Model (LLM) to generate **accurate, context-grounded responses**. --- ## Objectives * Build a **manual RAG pipeline** (no LangChain or pre-built frameworks) * Improve retrieval accuracy using: * Hybrid search * Query expansion * Domain-specific scoring * Reduce hallucination through structured prompting * Provide explainable outputs with retrieved context --- ## System Architecture ``` User Query ↓ Query Expansion ↓ Embedding Model ↓ Hybrid Retrieval (Vector + Keyword) ↓ Reranking (Domain-Specific Scoring) ↓ Top-K Relevant Chunks ↓ Prompt Builder ↓ LLM (OpenAI / Gemini) ↓ Final Answer (Streamlit UI) ``` --- ## Features ### Hybrid Retrieval * Combines: * FAISS vector similarity * Keyword matching * Improves both semantic and exact-match retrieval --- ### Query Expansion * Expands queries using synonyms * Example: * "winner" → "won", "victor" * Improves performance on paraphrased questions --- ### Domain-Specific Reranking ⭐ * Boosts relevance using: * Vote percentage * Region matching * Year matching * Ensures correct identification of election winners --- ### Post-Processing Reasoning (Innovation) ⭐ * Automatically identifies the **top candidate** based on votes * Injects structured hint into prompt * Improves answer consistency and accuracy --- ### Multi-LLM Support Supports: * OpenAI (GPT models) * Google Gemini Switch using environment variables. --- ## Project Structure ``` project/ │ ├── data/ │ ├── Ghana_Election_Result.csv │ └── 2025-Budget-Statement.pdf │ ├── src/ │ ├── data_loader.py │ ├── chunking.py │ ├── embedding.py │ ├── retrieval.py │ ├── pipeline.py │ ├── prompt.py │ └── llm. …