- English-only (clean, professional responses)
- FREE (uses Ollama Mistral β no API costs)
- No Hindi gibberish (perfect English)
- MongoDB storage (all conversations saved)
- Real AI (human-like responses)
- Production-ready (reliable & fast)
cd pmjay-english
pip install pymongo
python seed_data.pyOutput:
β
Inserted 6 beneficiaries
β
Inserted 5 ration cards
β
Inserted 7 hospitals
π DATABASE SEEDED SUCCESSFULLY!
pip install -r requirements.txtTerminal 1:
ollama serveCheck if mistral is available:
ollama listIf mistral not in list, pull it:
ollama pull mistralTerminal 2:
uvicorn main:app --reloadhttp://localhost:8000
You: hello
Bot: Hello! I'm PMJAY AI-Mitra. I can help you with PM-JAY eligibility checks, finding hospitals, and understanding scheme benefits. What would you like to know?
You: am i eligible?
Bot: I can help you check PM-JAY eligibility! π
Please choose one:
β’ Type 'Aadhaar' to check with Aadhaar number
β’ Type 'Ration' to check with Ration Card number
You: aadhaar
Bot: Please enter your 12-digit Aadhaar number.
π For demo, try: 123456789012
You: 123456789012
Bot: β
Great news! Ramesh Kumar is eligible for PM-JAY.
π Details:
β’ Card Number: PMJAY-UP-12345
β’ State: Uttar Pradesh
β’ Family Members: 3
You: find hospital
Bot: I'll help you find empanelled hospitals! π₯
Please tell me your state name.
You: Bihar
Bot: Got it! Searching for hospitals in Bihar.
Please provide your 6-digit pincode.
You: 800001
Bot: π₯ Found 2 empanelled hospital(s):
β’ AIIMS Patna
π Patna, Bihar
π 0612-2451070
β’ IGIMS Patna
π Patna, Bihar
π 0612-2297321
You: what is PMJAY?
Bot: π About Pradhan Mantri Jan Arogya Yojana (PM-JAY):
β’ World's largest health insurance scheme
β’ βΉ5 lakh coverage per family per year
β’ Covers 1,949 medical procedures
β’ Cashless treatment at 27,000+ empanelled hospitals
You: how does it work?
Bot: [AI explains in natural English]
You: is it free?
Bot: [AI explains free eligibility and benefits]
123456789012 β Ramesh Kumar (Eligible β
)
111122223333 β Sita Devi (Eligible β
)
999988887777 β Amit Sharma (Not Eligible β)
444455556666 β Priya Singh (Eligible β
)
777788889999 β Mohammad Alam (Eligible β
)
555566667777 β Lakshmi Bai (Eligible β
)
RC1001 β Eligible β
RC2002 β Not Eligible β
RC3003 β Eligible β
RC4004 β Eligible β
RC5005 β Eligible β
800001 β Bihar (AIIMS Patna, IGIMS Patna)
110001 β Delhi (AIIMS Delhi)
201301 β Uttar Pradesh (Max Hospital Noida)
600006 β Tamil Nadu (Apollo Hospital Chennai)
700107 β West Bengal (Fortis Hospital Kolkata)
462001 β Madhya Pradesh (Hamidia Hospital Bhopal)
http://localhost:8000/stats
Response:
{
"beneficiaries": 6,
"ration_cards": 5,
"hospitals": 7,
"conversations": 12,
"active_sessions": 1
}http://localhost:8000/test-ai
Response:
{
"status": "β
Working",
"model": "mistral",
"ai_response": "Hello! How can I help you today..."
}- Ollama is FREE forever
- No API charges
- Runs on your laptop
- Clean, professional responses
- No Hindi gibberish
- Perfect grammar
- Mistral model (optimized for English)
- Fallback to structured responses
- No timeouts
- MongoDB storage
- Session management
- Conversation history
- Error handling
Check MongoDB:
mongosh
# Should connect successfullyIf not running:
net start MongoDB # Windows
brew services start mongodb-community # Mac
sudo systemctl start mongod # Linuxollama pull mistral
# Wait for download (it's ~4GB)
ollama list
# Should show mistral nowSolution: We're using Mistral (better than phi3) and system prompts are optimized for English. Should not happen!
If it does:
- Restart Ollama:
ollama serve - Check terminal logs for errors
- Fallback responses will work anyway
This is normal β Mistral takes 3-5 seconds locally. But responses are high quality!
To speed up:
- Use lighter model: Change
model="phi3"in main.py (faster but lower quality) - Or use GPU if available
- Add more data (100+ beneficiaries, 50+ hospitals)
- Voice input (speech-to-text)
- File upload (Aadhaar card image β OCR)
- WhatsApp integration
- Analytics dashboard
Before deployment, verify:
- MongoDB running
- Database seeded (6 beneficiaries, 5 cards, 7 hospitals)
- Ollama running with mistral
- Backend running (port 8000)
- Browser opens chatbot
- Quick action buttons work
- Eligibility check works
- Hospital search works
- AI responses are clean English
- No Hindi gibberish
- Conversations saving to MongoDB
All β ? PERFECT! Demo ready. π
- Better English understanding
- More natural responses
- Less likely to give gibberish
- Slightly slower but worth it
- Ollama models struggle with Hindi
- Would need Gemini API for good Hindi (costs money)
- English is professional & reliable
- Most government portals use English anyway
- YES! 100% free forever
- Ollama is open-source
- MongoDB community edition is free
- No hidden costs
Found a bug or want to contribute? Feel free to:
- π Report Issues
- π‘ Suggest features
- π§ Submit pull requests
AI Agent Developer | Generative AI & LLM Engineer | AI/ML Enthusiast | Open Source Contributor
If you found this project helpful, please consider giving it a β on GitHub!
- PM-JAY Team - For the world's largest health insurance scheme
- Ollama - For providing free, open-source AI models
- MongoDB - For robust database solutions
- FastAPI - For the powerful and fast backend framework
