
Building a Localized AI Legal Assistant with Angular, Firebase & Gemini
Building AI applications for the legal sector presents a unique set of engineering challenges. General-purpose LLMs are notorious for hallucinating laws or confidently quoting United States federal law to users living in Nairobi or Kampala. To solve this, I built SheriaSenseEA , a localized AI legal assistant specifically engineered for East Africa (Kenya, Uganda, and Tanzania). Rather than relying on generic chat completion, this architecture utilizes strict System Prompting, forced frontend context injection, and multimodal document analysis to keep the AI strictly within the bounds of East African constitutional law. Here is a deep dive into how it is built using Angular , Firebase Cloud Functions , and the Gemini 2.5 Pro model. The Architecture of Constraint The biggest risk in LegalTech is the AI giving advice outside its jurisdiction or acting as a general-purpose chatbot. To prevent this, SheriaSenseEA employs a two-tier constraint system: Frontend Context Injection and Backend
Continue reading on Dev.to
Opens in a new tab

