Logo Lanfrica

Anaase-Tech/African-AI

Domain:

natural language processing

Record type:

software
Creator:
Ana
Host:
Africa's First Al # African AI v4.1 🌍 **Built by Africans Β· Powered by African Knowledge** By Anaase-Tech | Founder/CEO: Y.A B3rima ## What is African AI? A RAG (Retrieval-Augmented Generation) chatbot built specifically for African knowledge β€” languages, history, philosophy, culture, music, food, leaders, spirituality, and more. πŸ”— **Live Demo:** b3rima1-african-ai.hf.space --- ## Project Structure ``` african-ai/ β”œβ”€β”€ app.py # Gradio UI + launch (entry point) β”œβ”€β”€ config.py # API keys, paths, model names β”œβ”€β”€ knowledge.py # LOCAL_TERMS, PROVERBS, DATASET_TOPICS β”œβ”€β”€ language.py # detect_language(), strict v4.1 mode β”œβ”€β”€ retrieval.py # Wikipedia fetch, ChromaDB, BM25, hybrid search β”œβ”€β”€ respond.py # respond() β€” the full chat pipeline └── requirements.txt # Dependencies ``` ## Architecture ``` User Query ↓ Local Dictionary (56 African terms) β€” instant exact match ↓ (if no match) Hybrid Retrieval β”œβ”€β”€ BM25 keyword search (40%) β€” exact names, rare terms └── Vector search (60%) β€” semantic meaning ↓ Reciprocal Rank Fusion β€” merges both rankings ↓ Diversity filter β€” no duplicate titles ↓ Groq LLaMA 3.1 (streaming) β€” grounded answer ↓ Response with sources ``` ## Key Features - **4,251 knowledge chunks** across 14 African categories - **Multilingual embeddings** β€” `intfloat/multilingual-e5-base` handles Twi, Swahili, Yoruba, Hausa, Zulu - **Strict language detection** β€” defaults to English, only switches on explicit request - **Historical figures** skip local dict β€” use rich Wikipedia chunks instead - **Exponential backoff** on Wikipedia fetches β€” near-zero skipped topics - **Mobile-first UI** β€” designed for Samsung A04e, Pan-African gold/green theme ## v4.1 Fixes - Language drift fixed β€” "Tell me about Kenya" no longer triggers Swahili mode - NoneType crash fixed β€” `message=None` safely handled - Fusion key collision fixed β€” MD5 hash replaces `doc[:120]` - Diversity filter β€” same title can't fill all 3 result slots - Exponential backoff β€” Wikiped …