Inspiration
While platforms like myScheme do a great job cataloging India’s 3,400+ government welfare programs, millions of citizens still miss out on life-changing benefits. The barrier isn't a lack of schemes; it's the sheer complexity of bureaucratic language, strict eligibility overlaps, and the digital divide. We realized citizens don't just need a search engine—they need a "Mitra" (friend/advisor). We were inspired to build an AI agent that doesn't just give a generic list, but rather provides a prioritized action plan, in a native language, over a familiar platform like WhatsApp.
What it does
Sarkari-Mitra is a bilingual AI advisor accessible via WhatsApp and a Gradio web app. Users simply describe their situation in Hindi, English, Hinglish, or regional languages (e.g., "I am a 45-year-old widow farmer from MP with a BPL card"). The system:
- Extracts their profile into a structured JSON.
- Matches eligible schemes through a hybrid SQL + semantic search.
- Returns a prioritized action plan. Instead of just listing scheme names, it consolidates the required documents across all eligible schemes so the user only has to gather them once, and provides official helpline numbers.
How we built it
We built the entire intelligence and data layer on the Databricks Free Edition:
- Data Layer: We ingested 3,400 schemes into a Delta Lake table via Apache Spark, isolating criteria like age, income, and state. We chunked the text and embedded it into a FAISS index hosted on a DBFS Volume.
- Intelligence Layer: We used Llama 3.3 70B via the Databricks AI Gateway as our core reasoning engine.
- Translation: We integrated Sarvam AI at the edges to translate regional languages to English for the LLM, and back to the user's native language for the output.
- Interfaces: We built a Gradio web app and a FastAPI + Twilio WhatsApp bot, using Redis for short-term conversational memory and Unity Catalog to securely store long-term user profiles.
Challenges we ran into
- The WhatsApp 15-Second Timeout: Twilio drops webhooks if a reply takes longer than 15 seconds. Initially, chaining multiple LLM calls (translate -> extract profile -> retrieve -> generate) was too slow. We solved this by engineering a "Single-call router + profile" prompt, collapsing intent classification and entity extraction into one LLM call, cutting latency by ~4 seconds.
- Deadly Hallucinations: When dealing with government schemes, the AI cannot guess document requirements. To fix this, we built "Section-aware RAG." If a user asks "What documents do I need?", the system filters the retrieval to only pull from the
documentschunks in our Delta table, drastically reducing hallucinations.
Accomplishments that we're proud of
- Low Hallucination Rate: By using strict section-aware RAG and graceful degradation (falling back to a polite decline if data isn't found), we achieved a hallucination rate of
<3%. - Document Consolidation Logic: We are incredibly proud of our logic that reduces 15 redundant document requirements across 5 different schemes into a clean list of 5 unique documents to fetch once.
- Seamless Multilingual Pipeline: Achieving an 8-12 second end-to-end response time on WhatsApp while translating from regional languages to English, processing SQL/FAISS queries, and translating back.
What we learned
We learned that building production-ready RAG is much more about data engineering than prompt engineering. Structuring our Delta Tables properly was the key to our success. We also learned how powerful Databricks Unity Catalog is for managing access to sensitive user profiles alongside public data, and how to leverage Spark MLlib (using KMeans clustering) to prioritize schemes by approval speed for the user.
What's next for Sarkari-Mitra
- Voice-First Interaction: Fully integrating Whisper/Sarvam STT and TTS so users who cannot read or write can just send a voice note on WhatsApp and get an audio action plan back.
- DigiLocker Integration: Allowing users to securely connect their DigiLocker to auto-verify which documents they already possess.
- State-Level Expansion: Moving beyond central schemes to scrape and include hyper-local Panchayat and municipal-level welfare programs.
Built With
- apache-spark
- cloudflare
- databricks
- delta-lake
- faiss
- fastapi
- gradio
- llama-3
- mlflow
- python
- redis
- sarvam-ai
- twilio
- unity-catalog