A smart chatbot that provides short, medically-aware first-aid guidance for emergencies related to:
- Diabetes
- Cardiac issues
- Renal conditions
It uses:
- ๐ง Gemini API for condition detection and final answer generation
- ๐ Local medical knowledge (from a curated Excel file)
- ๐ Live web search using Serper.dev (Google Search API)
- โ Answers limited to โค 250 words with disclaimers and citations
This chatbot is for educational purposes only and is not a substitute for professional medical advice.
RAG-FirstAid-Chatbot/
โ
โโโ src/
โ โโโ chatbot.py # Main pipeline
โ โโโ model.py # Checkout the model available through API
โ โโโ triage.py # Gemini: symptom โ condition
โ โโโ retrieval.py # Local snippet retriever
โ โโโ web_search.py # Serper.dev integration
โ โโโ generator.py # Gemini: RAG response builder
โ
โโโ tests/
โ โโโ test_bot.py # Unit test for pipeline
โ |โโ test_queries.py # Evaluates all 10 official test cases
โ โโโ test_queries_response.md # Response of all 10 official test cases
โ
โโโ Assignment Data Base.xlsx # Local knowledge base
โโโ requirements.txt # List of required libraries
โโโ .env # API keys
โโโ README.md
โโโ architecture.md # System flow
โโโ performance.md # Evaluation results
git clone <your-repo-link>
cd RAG-FirstAid-Chatbot
python -m venv venv
venv\Scripts\activate # (use source venv/bin/activate for Linux/Mac)
pip install -r requirements.txtCreate a .env file and add:
GEMINI_API_KEY=your_google_api_key
SERPER_API_KEY=your_serper_api_key# From project root
python -m src.chatbotThen modify the query variable inside chatbot.py for different test inputs.
# Unit test
set PYTHONPATH=.
pytest tests/
# 10 official test cases
python tests/test_queries.py| Area | Design Decision | Trade-off |
|---|---|---|
| Triage | Gemini API | More accurate than keyword matching, but slower |
| Knowledge Base | Excel file + embeddings (local) | Simple setup; no DB required |
| Retrieval | Top-3 local + top-3 web | Balances trust (local) + freshness (web) |
| Answer Gen | Gemini RAG prompt with strict template | Keeps output short & informative |
| Testing | Manual + Pytest + Query evaluation script | No UI, but CLI is simple to demo |
- โ Gemini-powered symptom triage
- โ Combined local and web retrieval
- โ Medically aware answers
- โ Unit tests + test queries
- โ Ready for demo and GitHub push
- Add interactive chat UI (e.g., Streamlit or Gradio)
- Deploy as web app with REST API
- Add medical named entity recognition (NER)