Overview
Every query is routed through a fallthrough chain: smalltalk → semantic cache → emergency handler → 12 live/curated handlers → intent dispatch → curated KB (100K+ entries) → web fallback. First hit wins. Warm-path latency: P50 2ms · P95 3ms.
Answer endpoint
Route a free-text query to the most appropriate handler and return a structured answer.
Request
POST https://demo.axz.si/api/gsi/answer
Content-Type: application/json
{"query": "petrol price nepal"}
Response
{
"answer_en": "⛽ Nepal fuel prices — NOC reference (Kathmandu Valley retail)\n...",
"grounded": true,
"source": "fuel_handler",
"match": {
"id": "fuel:petrol",
"title": "Petrol — NPR 175/litre",
"category": "curated_fuel",
"score": 1800.0,
"highlighted":"petrol",
"prices_npr": { "petrol": {"unit":"litre","price":175.00,...}, ... }
},
"citations": [{"kind":"curated","source":"Nepal Oil Corporation (noc.org.np)",...}],
"traversal_trace": ["fuel_handler: petrol"],
"query_class": "live_handler",
"compute_ms": 2.4,
"_cache": {"hit": false, "key": null},
"_intent": {"intent":"fuel","confidence":0.85,...}
}
Handlers
emergency_handler
16 bilingual first-aid cards (snake bite, heart attack, stroke, burn, drowning, choking, seizure, poisoning, fire, quake, flood, landslide, suicide, DV, child abuse).
weather_handler
Live weather for 15 Nepal cities via open-meteo. Bilingual card + advisory (heat, cold, thunder, wind, rain).
aqi_handler
US AQI + PM2.5 + PM10 via open-meteo. 6-level bilingual health advisory.
quake_handler
USGS earthquake feed filtered to Nepal region. Latest quake + 30-day totals + magnitude advisory.
news_handler
Top 8 bilingual headlines from Gorkhapatra + Kantipur + Nagarik + BBC Nepali + Setopati + Al Jazeera + NYT.
calendar_handler
AD ↔ BS date, weekday bilingual, Nepal fiscal year, Bikram Sambat panchang.
currency_handler
Live NPR conversion for USD/EUR/GBP/INR/AED/+9 via open.er-api.com (ECB daily).
holiday_handler
Next Nepal public holiday + all remaining this year (Dashain, Tihar, Buddha Jayanti, Chhath, etc).
distance_handler
Curated km + drive-time between top Nepal cities (KTM ↔ Pokhara, Chitwan, Biratnagar, etc).
geography_handler
Peaks (8 eight-thousanders), rivers (Koshi, Gandaki, Karnali, Bagmati, Mahakali), lakes (Rara, Phewa, Tilicho).
fuel_handler
NOC reference prices for petrol / diesel / kerosene / LPG cylinder.
metals_handler
FENEGOSIDA daily reference for gold (24k / 22k / worked) and silver, per tola + per 10g.
bank_handler
NRB policy rate + commercial bank savings / FD / home / auto / personal loan rates.
calculator
AST-based safe arithmetic (2+2, 2**10, sqrt, log, etc).
date_time
Current NPT + BS date + weekday.
smalltalk_guard
Handles greetings, name questions, capability probes bilingually.
curated_kb
94,300 keyword-indexed entries across ministries, services, culture, medical pathways.
web_fallback
Wikipedia + DuckDuckGo when no KB confidence — Nepal-context biased.
Auxiliary endpoints
Structured JSON of today's Nepal news feed (up to 20 items from 13 sources). Refreshed every 30 min.
Live-handler cache stats (hits, misses, hit-rate, active entries, TTL config).
Query volume + P50/P95 latency + cache hit-rate for the rolling window.
Top-N most-frequent queries.
Actionable KB-expansion targets: queries with low confidence + low volume.
Auto-refreshing analytics dashboard (24h volume, top queries, misroutes, coverage, cache stats).
Example curls
# Emergency (safety-critical, highest score)
curl -sS -X POST https://demo.axz.si/api/gsi/answer \
-H 'Content-Type: application/json' \
-d '{"query":"snake bite emergency"}' | jq
# Live weather (any of 15 Nepal cities, bilingual)
curl -sS -X POST https://demo.axz.si/api/gsi/answer \
-H 'Content-Type: application/json' \
-d '{"query":"पोखराको मौसम"}' | jq
# Currency (100 USD → NPR)
curl -sS -X POST https://demo.axz.si/api/gsi/answer \
-H 'Content-Type: application/json' \
-d '{"query":"100 usd in npr"}' | jq
Design principles
- Sovereign. No proprietary LLM, no external RAG, no vector database, no chain-of-thought. Pure grounded structural intelligence.
- Bilingual by default. Every handler accepts English + Nepali (Devanagari) queries and emits bilingual response fields.
- Safety-first. Emergency handler runs UNCONDITIONALLY before any intent classifier — safety trumps latency.
- Warm-path fast. Live handlers cache with per-intent TTL. P95 3ms warm; cold live-fetch 200-500ms one-time.
- No black boxes. Every response includes
traversal_trace,citations, and_intentmetadata.