AI-Powered Public-Service Discovery, Deterministic Eligibility Evaluation & Real-Time Location Intelligence
Find the help you need. Know what to do next. Fast, verified, and safe.
π Live Demo Application Β β’Β π» GitHub Repository Β β’Β π Swagger API Docs Β β’Β ποΈ Architecture Specification
| Resource | Verified Production Link | Description |
|---|---|---|
| π Live Web Application | sahay-cyan.vercel.app | Unified full-stack production deployment on Vercel |
| π Interactive API Docs | /api/docs | Interactive Swagger UI API documentation |
| π OpenAPI Specification | /api/openapi.json | Raw OpenAPI 3.1 JSON schema specification |
| β€οΈ API Health Check | /api/health | Live system health status endpoint (HTTP 200 OK) |
| π» Source Code | github.com/mrashish18/sahay | Public GitHub repository |
Citizens seeking public assistance or emergency disaster aid face severe administrative and cognitive friction:
- Fragmented Public Services: Welfare schemes and disaster helplines are scattered across hundreds of municipal, state, and national portals.
- Dense Legal Jargon: Complex administrative terminology creates confusion for citizens searching in natural language (e.g. searching for "ration for my children" instead of scheme IDs).
- Probabilistic Hallucination Risk: Generative AI tools often fabricate non-existent government benefits or misinterpret strict statutory eligibility criteria.
- Dangerous Emergency Delays: Generic chatbots treat life-threatening flood or fire crises like routine paperwork inquiries, delaying life-saving evacuation guidance.
SAHAY 2.0 is an AI-powered public-service decision-support engine designed to connect citizens to verified government benefits, code-evaluated eligibility, actionable document checklists, and safety-first crisis routing.
π‘ Core Design Philosophy: Natural language interprets citizen context; deterministic Python code evaluates legal eligibility; safety-first crisis routing intercepts emergency distress above administrative paperwork.
- π₯« Public Service Discovery: Matches conversational queries in English, Hindi, or Hinglish to official government welfare schemes with required document checklists and verified portal links.
- βοΈ Deterministic Eligibility Evaluation: Executes statutory qualification criteria in Python code outside probabilistic language model text generation.
- π¨ First-Class Crisis Routing: Unconditionally prioritizes physical safety guidance, evacuation protocols, and emergency helplines during disasters.
- π¦οΈ Universal Location Intelligence: Resolves misspellings, historical aliases, abbreviations, and global locations for real-time weather and civic forecasts.
- π Jurisdiction Isolation: Enforces strict containment between Indian (
IN) and US (US) welfare databases. - π Sandboxed Tool Execution (TTE): Protects tool proposals through AST static analysis (
ast.parse) safety controls.
Natural-language public-service discovery paired with verified source traceability & legal disclaimers
First-Class Crisis Routing β Physical evacuation steps & priority helplines surface above paperwork
Universal location resolution paired with real-time Open-Meteo weather forecasts
End-to-end request processing flow paired with Sandboxed Tool Execution Engine (TTE) controls
Try Sahay directly with natural-language questions in the live demo. The examples below cover the core capabilities demonstrated in the live production system.
Will tomorrow rain in Patna?
Will today rain in Chennai?
Will day after tomorrow rain in Triveniganj?
Will day after tomorrow rain in UP?
Will day after tomorrow rain in MADRAS?
Will day after tomorrow rain in Darbhangha?
| User Input | Resolved Location | Administrative Region | Country |
|---|---|---|---|
UP |
Uttar Pradesh | Representative forecast (Lucknow region) |
India |
MADRAS |
Chennai | Tamil Nadu | India |
Darbhangha |
Darbhanga | Bihar | India |
Bombay |
Mumbai | Maharashtra | India |
Calcutta |
Kolkata | West Bengal | India |
Bangalore |
Bengaluru | Karnataka | India |
I need food assistance in Bihar.
I need help finding government assistance.
What government support is available for my family?
I need help with a government scheme.
Am I eligible for food assistance?
What are the eligibility requirements?
Can you check whether I qualify?
What information do you need to check my eligibility?
What documents do I need?
What documents are required for this service?
What should I prepare before applying?
There is a flood near me. What should I do?
My house was damaged by flooding in Bihar and we have nowhere to stay tonight.
Where can I get emergency help?
What should I do after being displaced by a disaster?
Use these queries sequentially in the same conversation session to test Sahay's context retention and topic state handling:
Will tomorrow rain in Chennai?
What about tomorrow?
Will today rain in Chennai?
How about Patna?
Demonstrates location switching, temporal updates, and contextual follow-up handling.
I need food assistance in Bihar.
Am I eligible?
What documents do I need?
Demonstrates topic-scoped context across eligibility and document follow-ups.
Will day after tomorrow rain in Xyzabc12345?
When a location cannot be confidently resolved, Sahay asks for clarification (validation_status = "FAILED") or returns a transparent failure message rather than silently inheriting a stale previous location.
π‘ Judge Tip: Start with a weather question, switch the location, change the requested date, and then try a public-service or crisis question in the same session to see Sahay's contextual decision pipeline in action.
SAHAY is built as a high-performance full-stack application. The React + Vite frontend is served alongside a FastAPI backend via same-origin /api/* serverless routes on Vercel.
User Query (English / Hindi / Hinglish)
β
βΌ
[ Semantic NLU Understanding ]
(Extracts Intent, Facts, Location & Jurisdiction)
β
βββββββββββββββββββββ΄ββββββββββββββββββββ
βΌ βΌ
[ Crisis Safety Route ] [ Standard Civic Route ]
(Evacuation & Helplines) (Knowledge Base Retrieval)
β β
βββββββββββββββββββββ¬ββββββββββββββββββββ
βΌ
[ Universal Location Intelligence ]
(Extraction β Alias Normalization β Geocoding)
β
βΌ
[ Real-Time Open-Meteo Integration ]
β
βΌ
[ Deterministic Eligibility Engine ]
(Code-Verified Criteria Evaluation)
β
βΌ
Structured SahayResponse JSON Payload
The backend orchestrates queries through modular, decoupled services:
| Service Component | File Location | Core Responsibility |
|---|---|---|
| AI Orchestrator | ai_orchestrator.py |
End-to-end request orchestration and decision routing |
| Semantic NLU | semantic_understanding.py |
Fact extraction, intent classification, pronoun resolution, and location parsing |
| Crisis Navigator | crisis_navigator.py |
Emergency safety intercept, physical evacuation guidance, and helpline dispatch |
| Eligibility Engine | eligibility_engine.py |
Deterministic Python evaluation of statutory criteria |
| Knowledge Base | knowledge_base.py |
Hybrid RAG retrieval over verified government scheme datasets |
| Conversation Memory | conversation_memory.py |
Topic-scoped multi-turn context retention and active scheme state tracking |
| Web Search Service | web_search_service.py |
Real-time Open-Meteo weather forecasting and location resolution |
| TTE Engine | tte_engine.py |
Sandboxed tool proposal engine with AST static analysis security |
Supports arbitrary geographic entities through extraction, normalization, geocoding, candidate ranking, and clarification fallback, subject to the coverage of the underlying geographic data provider.
- Extraction: Preposition matching (
in <location>), explicit parameters, and composite location parsing (Madras, Oregon). - Normalization & Aliasing: Translates abbreviations (
UPβUttar Pradesh) and historical names (MADRASβChennai, Tamil Nadu,BombayβMumbai,CalcuttaβKolkata,BangaloreβBengaluru) without hardcoding massive dictionaries. - Phonetic & Misspelling Correction: Resolves typos (e.g.,
DarbhanghaβDarbhanga, Bihar). - Geocoding & Candidate Ranking: Queries Open-Meteo Geocoding API with multi-candidate scoring based on population, admin region, and country context.
- State/UT Representative Policy: State or Union Territory forecasts render an honest representative header using the regional capital (e.g.,
"Representative forecast for Uttar Pradesh (Lucknow region)"). - Transparent Fallback: If a location cannot be resolved, SAHAY asks for clarification (
validation_status = "FAILED") without inheriting stale locations from context.
- Production Secret Validation: Enforces strict validation of
SECRET_KEYand production configuration. - Deterministic Legal Rules: Statutory eligibility logic runs exclusively in Python code, preventing LLM hallucination of benefits.
- TTE AST Security Linter: Dynamic tool proposals are validated via
ast.parse, blocking dangerous operations (os,sys,subprocess) or arbitrary execution. - Prompt Injection Defense: Input text is sanitized and wrapped before reaching language model context windows.
- Tool-Result Validation: All tool outputs undergo structural validation before integration into user responses.
- Jurisdiction Containment: Enforces strict isolation between Indian (
IN) and US (US) welfare datasets. - No Chain-of-Thought Exposure: Internal reasoning traces remain internal and are never exposed to end users.
All engineering benchmarks have been empirically verified:
| Benchmark Check | Result | Details |
|---|---|---|
| Backend Test Suite | 120 / 120 Passed | 100% pass rate across unit, integration, and scenario tests |
| Frontend Vite Build | Passed | Clean TypeScript compilation and bundle generation in 2.9s |
| Service Synchronization | 100% Identical | Byte-for-byte MD5 hash match between backend and frontend service modules |
| Production Health API | HTTP 200 OK | Verified at https://sahay-cyan.vercel.app/api/health |
| Production OpenAPI | HTTP 200 OK | Validated OpenAPI 3.1 JSON schema at https://sahay-cyan.vercel.app/api/openapi.json |
| Location Matrix Smoke Test | 10 / 10 Passed | Live production verification of aliases, states, misspellings, and global locations |
sahay/
βββ api/
β βββ index.py # Vercel serverless API entrypoint
βββ backend/
β βββ app/
β β βββ main.py # FastAPI application initialization & routes
β β βββ models/ # Pydantic data schemas & response models
β β βββ services/ # Core intelligence, NLU, eligibility & search services
β βββ tests/ # 120 Pytest verification test scripts
βββ docs/ # Technical architecture, security & evaluation specs
βββ frontend/
β βββ app/ # Frontend service mirror for unified deployment
β βββ src/ # React 18 + TypeScript + Vite UI components
β βββ package.json # Frontend dependencies & build scripts
βββ screenshots/ # Application UI demonstration assets
βββ pyproject.toml # Python configuration & test settings
βββ vercel.json # Vercel full-stack deployment configuration
βββ README.md # System documentation
- Python 3.12
- Node.js 18+
git clone https://github.com/mrashish18/sahay.git
cd sahay
cp .env.example .envcd backend
python -m venv venv
# On Windows: .\venv\Scripts\activate
# On Linux/macOS: source venv/bin/activate
pip install -r requirements.txt
python -m uvicorn app.main:app --port 8002 --reloadcd frontend
npm install
npm run devAccess the application locally at http://localhost:5173.
{
"message": "will day after tomorrow rain in UP",
"conversation_id": "user_session_123",
"user_context": {
"state": "Uttar Pradesh"
}
}{
"response": "π§οΈ Day after tomorrow Representative forecast for Uttar Pradesh (Lucknow region)\n\nDaily forecast (24-hour total):\nβ’ Rain Probability: 94%\nβ’ Temperature Range: 26Β°C β 32Β°C\nβ’ Conditions: Thunderstorm with slight hail βοΈ",
"flow": "WEB_SEARCH_REQUIRED",
"situation": {
"summary": "π§οΈ Day after tomorrow Representative forecast for Uttar Pradesh (Lucknow region)",
"weather_data": {
"city": "Uttar Pradesh",
"entity_type": "STATE",
"admin_region": "Uttar Pradesh",
"country": "India"
}
}
}- π― High Social Impact: Direct assistance for underprivileged citizens navigating public welfare and emergency crises.
- β‘ Zero Hallucination Eligibility: Deterministic Python rule evaluation eliminates false promises of government benefits.
- π‘οΈ Safety-First Crisis Routing: Emergency disaster handling prioritizes human life above paperwork.
- π¦οΈ Robust Location Resolution: Gracefully handles abbreviations, regional state names, historical aliases, and typos without hardcoding giant databases.
- π Full-Stack Production Ready: Deployed live on Vercel with same-origin serverless API routes and zero localhost dependencies.
- π Expanded Welfare Schemes: Integrate additional state-level schemes across India and global municipal jurisdictions.
- π£οΈ Voice & Regional NLU: Add speech-to-text and multi-lingual voice interaction in regional Indian languages.
- π Direct Portal Submissions: Connect with official government service APIs where public submission endpoints exist.
- π‘ Offline/Low-Bandwidth Mode: Progressive Web App (PWA) offline caching for low-connectivity rural regions.
SAHAY 2.0 β Universal Civic Navigator
Bridging the gap between citizen need and verified public support.
Built for civic empowerment β’ Designed for trust β’ Engineered for impact







