MediBlaze is an intelligent AI-powered medical assistant that provides comprehensive health information through a modern web interface. It combines medical knowledge base retrieval (RAG) with real-time web search to deliver accurate, up-to-date health guidance.
- Advanced medical knowledge base with RAG (Retrieval Augmented Generation)
- Real-time web search for latest medical information
- Smart tool selection - uses RAG first, web search when needed
- Comprehensive health domain coverage
- Diseases & Conditions: Symptoms, causes, diagnosis, complications
- Treatments & Medications: Therapies, drug information, side effects
- Preventive Health: Lifestyle changes, diet, exercise, wellness
- Sexual Health & Education: Reproductive health, contraception, STI prevention
- Mental Health: Stress management, emotional well-being
- Nutrition: Dietary guidance, eating habits, food safety
- Body Changes: Growth, aging, hormonal changes
- Health Safety: First aid, injury prevention
- Real-time streaming responses with markdown rendering
- Tool usage indicators ("Thinking...", "Searching web...")
- Responsive design with beautiful UI/UX
- Professional medical styling with health emojis
- FastAPI backend with async streaming
- LangGraph agent workflow
- Google Gemini AI integration
- Pinecone vector database for RAG
- Real-time Server-Sent Events (SSE)
- Markdown to HTML rendering
- Python 3.8+
- Google AI API Key
- Pinecone API Key
- Clone the repository
git clone <repository-url>
cd __MEDIBLAZE- Install dependencies
pip install -r requirements.txt- Set up environment variables
Create a
.envfile in the root directory:
GOOGLE_API_KEY=your_google_ai_api_key_here
PINECONE_API_KEY=your_pinecone_api_key_here- Run the application
python main.py- Access the interface
Open your browser and navigate to:
http://localhost:8000
# Build the image
docker build -t mediblaze .
# Run the container
docker run -p 8000:8000 \
-e GOOGLE_API_KEY=your_key \
-e PINECONE_API_KEY=your_key \
mediblaze# Create docker-compose.yml with your environment variables
docker-compose up -d__MEDIBLAZE/
βββ main.py # FastAPI application entry point
βββ requirements.txt # Python dependencies
βββ Dockerfile # Docker configuration
βββ docker-compose.yml # Docker Compose setup
βββ .env # Environment variables (create this)
βββ README.md # This file
β
βββ agent/ # AI Agent components
β βββ agent.py # LangGraph agent workflow
β βββ utils/
β βββ prompt.py # System prompts and instructions
β βββ tools.py # RAG and web search tools
β
βββ templates/ # Frontend templates
β βββ index.html # Main web interface
β
βββ static/ # Static assets
β βββ styles.css # Custom CSS styles
β βββ doctor-avatar.png # AI assistant avatar
β βββ user-avatar.png # User avatar
β
βββ Data/ # Knowledge base
βββ Book.pdf # Medical knowledge source
Main web interface
Standard chat endpoint
{
"message": "What are the symptoms of diabetes?"
}Streaming chat with real-time responses
{
"message": "How to manage stress naturally?"
}Health check endpoint
Interactive API documentation
- RAG First: Searches medical knowledge base for foundational information
- Evaluate: Determines if RAG information is complete and current
- Web Search: Only used when RAG is insufficient for:
- Recent medical developments
- Specific lifestyle advice not in knowledge base
- Current medication information
- Sexual health education topics
- Detailed procedures and guidelines
All responses follow a structured medical format:
## π₯ [Topic Title with Health Emoji]
[Brief overview explaining the topic]
**π― Key Points:**
- Point 1 with specific health details
- Point 2 with relevant information
- Point 3 with important facts
**π Treatment/Management:**
- Primary treatment approaches
- Lifestyle recommendations
- Prevention strategies
---
> β οΈ **Important**: Consult healthcare professionals for personalized advice.- Educational Purpose Only: MediBlaze provides educational health information, not medical diagnosis
- Not Emergency Care: For medical emergencies, contact emergency services immediately
- Consult Professionals: Always consult qualified healthcare professionals for personalized medical advice
- No Diagnosis: This tool does not replace professional medical consultation
| Variable | Description | Required |
|---|---|---|
GOOGLE_API_KEY |
Google AI (Gemini) API key | Yes |
PINECONE_API_KEY |
Pinecone vector database API key | Yes |
# Health check
curl http://localhost:8000/health
# Chat endpoint
curl -X POST "http://localhost:8000/chat" \
-H "Content-Type: application/json" \
-d '{"message": "What are the symptoms of diabetes?"}'
# Streaming endpoint
curl -N "http://localhost:8000/chat/stream" \
-H "Content-Type: application/json" \
-d '{"message": "How to maintain good oral hygiene?"}'- "What are the symptoms of diabetes?"
- "How to manage stress naturally?"
- "What foods are good for heart health?"
- "How to maintain good oral hygiene?"
- "What are the benefits of regular exercise?"
- "How to improve sleep quality?"
- Update knowledge base in
Data/directory - Modify system prompt in
agent/utils/prompt.py - Test with various health queries
- Modify
templates/index.htmlfor layout changes - Update
static/styles.cssfor styling - Add new avatars in
static/directory
This project is for educational and informational purposes. Please ensure compliance with medical information regulations in your jurisdiction.
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
For issues or questions:
- Check the API documentation
- Review the health check endpoint
- Ensure all environment variables are set correctly