An intelligent healthcare support system using LangChain and OpenAI with multi-agent architecture.
- 🛡️ Safety Guardrails - Content filtering and PII protection
- 🎯 Intent Classification - Smart routing to specialized agents
- 🩺 Symptom Checker - Emergency detection with hospital routing
- 💊 Multi-Agent Recommendations:
- 🌿 Ayurvedic remedies
- 🧘 Yoga therapy
- 💡 Wellness guidance
- 🏥 Government Schemes - Health insurance and benefits
- 🧠 Mental Wellness - Support and resources
- 📍 Hospital Locator - Find nearby facilities
.
├── src/
│ ├── __init__.py # Package initialization
│ ├── config.py # Configuration management
│ ├── schemas.py # Data models
│ ├── workflow.py # Main workflow orchestrator
│ └── chains/
│ ├── __init__.py
│ ├── base_chains.py # Core chain implementations
│ └── specialized_chains.py # Domain-specific chains
├── cli.py # Interactive CLI interface
├── requirements.txt # Python dependencies
├── .env.example # Example environment variables
├── .env # Your actual API keys (not in git)
└── README.md # This file
pip install -r requirements.txtCreate a .env file in the project root:
cp .env.example .envEdit the .env file and add your API keys:
OPENAI_API_KEY=sk-your-actual-openai-key-here
TAVILY_API_KEY=tvly-your-actual-tavily-key-here- OpenAI API Key: Get from OpenAI Platform
- Tavily API Key: Get free key from Tavily (1000 searches/month free)
python cli.pyor
./cli.pyThe CLI provides a stateful chat interface with history:
$ python cli.py
🏥 Healthcare Assistant - Initializing...
✓ Ready!
Commands: 'exit' to quit, 'clear' to clear history, 'history' to view
You: I have a backache for 2 daysexit- Quit the applicationclear- Clear conversation historyhistory- View conversation history
from src import HealthcareConfig, HealthcareWorkflow
# Configuration (loads from .env automatically)
config = HealthcareConfig()
# Initialize workflow
workflow = HealthcareWorkflow(config)
# Process query
result = workflow.run("I have a headache and fever")
print(result)User Query
↓
🛡️ Safety Guardrail Check
↓
🎯 Intent Classification
↓
🔗 Route to Specialized Agent
↓
┌─────────────────────┐
│ Government Schemes │ → Search & Recommend
│ Mental Wellness │ → Support + Yoga
│ AYUSH Support │ → Traditional Medicine
│ Symptom Checker │ → Assess → Multi-Agent:
│ │ ├─ Emergency? → Hospital Locator
│ │ └─ Non-Emergency? → Ayurveda + Yoga + Wellness
│ Hospital Locator │ → Find Facilities
└─────────────────────┘
- ✅ Never commit your
.envfile to version control - ✅ The
.envfile is already listed in.gitignore - ✅ Built-in guardrails for PII and harmful content
- ✅ Medical emergencies are not blocked and routed appropriately
- ✅ Keep your API keys secure and don't share them
- Create a new chain class in
src/chains/specialized_chains.py - Add it to
src/chains/__init__.py - Initialize in
src/workflow.py - Add routing logic in the
run()method
The CLI runs with verbose logging enabled. You'll see:
- Safety check results
- Intent classification
- Chain execution steps
- Agent invocations
- Search queries and results
MIT