←Writing
AI & LLM Systems•December 2025•7 min read

Contextual Prompt Chaining for Emerging Markets: Inside Gasura's Financial AI

Adapting foundation models to understand informal economies, Mobile Money (MoMo) SMS payloads, and communal savings structures across East Africa.

Ismail Ismail

Ismail Ismail

Software Engineering Student · AI-Native Builder (Kigali, Rwanda)

The Challenge: LLMs Fail in Informal Economies

Standard financial budgeting apps assume structured bank feeds (Plaid, Open Banking APIs) and predictable monthly salaries. In Rwanda and across Sub-Saharan Africa, **over 80% of personal transactions occur via Mobile Money (MTN MoMo / Airtel Money)**, communal rotating savings (Tontines / Ibimina), and cash inflows.

When foundation models are asked to budget for informal income, they routinely give western-centric advice (*"Invest in index funds"* or *"Set up auto-debit"*). **Gasura** was engineered to solve this through localized contextual prompt chaining.


1. Multi-Stage Pipeline Architecture

Instead of asking a single prompt to parse, categorize, and advise, we split the workflow into 3 sequential micro-tasks:

terminal
1Raw MoMo SMS / Inflows ──► [ Stage 1: Entity Normalization ]
2 │
3 ▼
4 [ Stage 2: Volatility & Buffer Modeling ]
5 │
6 ▼
7 [ Stage 3: Localized Advisory Generator ]

1. **Stage 1 — Normalization**: Translates unstructured SMS alerts and informal amounts into normalized Rwandan Francs (RWF) transactions with transaction fee deductions. 2. **Stage 2 — Volatility Engine**: Calculates the household's emergency runway in days rather than months, accounting for seasonal price fluctuations. 3. **Stage 3 — Advisory Formulation**: Employs Gemini 1.5 Flash with strict JSON schemas to formulate practical, micro-action steps (*"Set aside 15,000 RWF for your communal group contribution on Friday"*).


2. Guardrails & Output Validation

We enforce deterministic structured outputs using Google GenAI SDK schema definitions:

typescript
1const responseSchema = {
2 type: "object",
3 properties: {
4 healthScore: { type: "number", minimum: 0, maximum: 100 },
5 bufferDays: { type: "integer" },
6 actionPlan: {
7 type: "array",
8 items: {
9 type: "object",
10 properties: {
11 step: { type: "string" },
12 amountRwf: { type: "number" },
13 urgency: { type: "string", enum: ["high", "medium", "low"] }
14 }
15 }
16 }
17 }
18};
💡 Key Architectural TakeawayImpact: Gasura won First Place at the 2025 Google AI Hackathon in Rwanda for its deep contextual relevance and sub-second advice latency.
#Gemini 1.5 Flash#Prompt Chaining#FinTech#Next.js#Rwanda