An intelligent, conversational AI Health Assistant that provides safe, contextually aware, and empathetic health information through advanced RAG (Retrieval-Augmented Generation) technology.
- ๐ Overview
- โจ Key Features
- ๐๏ธ Architecture
- ๐ ๏ธ Tech Stack
- ๐ Project Structure
- ๐ Quick Start
- โ๏ธ Configuration
- ๐งช Testing the System
- ๐ฌ API Documentation
- ๐ฏ Features Roadmap
- ๐ค Contributing
- ๐ License
- ๐ฅ Contributors
MediBot represents a significant evolution in AI-powered healthcare assistance, transitioning from simple rule-based responses to a sophisticated, full-stack application powered by modern artificial intelligence. This project bridges the gap between users and healthcare information by offering intelligent, contextually aware health guidance.
- Advanced RAG Pipeline: Unlike traditional chatbots, MediBot uses Retrieval-Augmented Generation to understand context, retrieve relevant medical information, and synthesize accurate responses
- Human-Like Conversations: Powered by Google's Gemini models with carefully crafted prompts that ensure natural, empathetic interactions
- Safety-First Design: Every response includes mandatory medical disclaimers and escalation guidance
- Modern Architecture: Full-stack application with React frontend, FastAPI backend, and Qdrant vector database
- Docker-Ready: Fully containerized for consistent development and deployment
โ ๏ธ Important Disclaimer: MediBot is designed for educational and informational purposes only. It is not a replacement for professional medical advice, diagnosis, or treatment. Always consult qualified healthcare providers for medical concerns.
- Natural Language Processing: Understands complex symptom descriptions in everyday language
- Contextual Responses: Provides relevant information based on medical knowledge base
- Graceful Fallbacks: When specific information isn't available, offers safe general wellness guidance
- Empathetic Communication: MediBot adopts a caring, supportive tone in all interactions
- No Technical Jargon: Avoids revealing its internal processes (like "according to the documents...")
- Consistent Character: Maintains its helpful health assistant persona throughout conversations
- Medical Disclaimers: Every response concludes with appropriate safety warnings
- Escalation Logic: Identifies when users should seek immediate medical attention
- Controlled Responses: Limited to safe, general wellness advice when specific data is unavailable
- RESTful API: Clean, well-documented FastAPI backend with automatic OpenAPI documentation
- Vector Search: Qdrant-powered semantic search for relevant medical information retrieval
- Responsive Frontend: Modern React application with intuitive user interface
- Containerized Deployment: Docker Compose setup for easy development and deployment
- Structured Logging: Comprehensive logging using Loguru for debugging and monitoring
- Request Tracking: Monitor query processing times and system performance
- Error Handling: Robust error management with meaningful user feedback
MediBot follows a modern, microservices-inspired architecture:
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ React Client โ โ FastAPI API โ โ Qdrant Vector โ
โ (Frontend) โโโโโบโ (Backend) โโโโโบโ Database โ
โ Port: 5173 โ โ Port: 8000 โ โ Port: 6333 โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ โ โ
โ โโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโบโ Google โโโโโโโโโโโโโโโโโ
โ Gemini AI โ
โโโโโโโโโโโโโโโโโโโ
- User Input: User submits health query through React frontend
- API Processing: FastAPI receives and validates the request
- Information Retrieval: Qdrant vector database searches for relevant medical information
- AI Generation: Google Gemini processes the context and generates human-like responses
- Safety Layer: Response validation and mandatory disclaimer addition
- User Response: Formatted response delivered to frontend
FastAPI - High-performance Python web framework
Python 3.11+ - Core programming language
Pydantic - Data validation and settings management
Google Gemini - Advanced language model for natural responses
LangChain - Framework for building LLM applications
Sentence Transformers - Text embedding models
React 18 - Modern JavaScript library for building user interfaces
Vite - Lightning-fast build tool
Tailwind CSS - Utility-first CSS framework
AI-HEALTH-CHATBOT/
โโโ backend/ # FastAPI Backend Application
โ โโโ app/
โ โ โโโ Medical_DataBase/ # Stores the FAISS vector index for the RAG model
โ โ โ โโโ index.faiss
โ โ โ โโโ index.pkl
โ โ โโโ models/ # Pydantic schemas for data validation (schemas.py)
โ โ โโโ routers/ # Defines the API endpoints (e.g., /chat, /disease)
โ โ โ โโโ chat.py
โ โ โ โโโ disease.py
โ โ โ โโโ health.py
โ โ โโโ services/ # Contains the core business logic for all features
โ โ โ โโโ disease_predictor.py
โ โ โ โโโ health_info.py
โ โ โ โโโ medical_agent.py # Manages the core RAG pipeline and LLM interaction
โ โ โ โโโ symptom_checker.py
โ โ โโโ utils/ # Utility and helper functions
โ โ โโโ config.py # Handles configuration and environment variables
โ โ โโโ main.py # The main entry point to launch the FastAPI server
โ โโโ data/ # Directory for raw data files like CSVs
โ โโโ requirements.txt # A list of all Python dependencies
โ
โโโ client/ # React Frontend Application
โ โโโ public/ # Contains static assets like the main index.html and icons
โ โโโ src/
โ โ โโโ api/ # Functions for making HTTP requests to the backend
โ โ โโโ assets/ # Stores local assets like images, fonts, and CSS
โ โ โโโ components/ # Reusable React components (e.g., ChatWindow, Button)
โ โ โโโ pages/ # Components representing entire pages or views
โ โ โโโ App.jsx # The main root component of the application
โ โ โโโ main.jsx # The entry point for the React application
โ โโโ package.json # Lists Node.js dependencies and project scripts
โ โโโ vite.config.js # Configuration file for the Vite build tool
โ
โโโ README.md # You are here!
Medibot is a Streamlit-based AI health assistant that provides symptom checking, health guidance, and doctor recommendations using NLP and Retrieval-Augmented Generation (RAG).
- Added translation pipeline (English โ Hindi, Marathi, Telugu).
- Integrated multilingual embeddings with FAISS.
- Added language selector in Streamlit UI.
- Ensured responses maintain medical safety disclaimer.
pip install -r requirements.txt
streamlit run app/WellnessResourceHub.py
AI-health-chatbot/
โโโ ๐ backend/ # Backend API and services
โ โโโ ๐ app/
โ โ โโโ ๐ config/ # Configuration management
โ โ โ โโโ ๐ __init__.py
โ โ โโโ ๐ models/ # Pydantic models and schemas
โ โ โ โโโ ๐ schemas.py
โ โ โโโ ๐ routers/ # FastAPI route handlers
โ โ โ โโโ ๐ chat.py # Main chat endpoint
โ โ โ โโโ ๐ rag.py # RAG pipeline endpoints
โ โ โโโ ๐ services/ # Business logic and AI services
โ โ โ โโโ ๐ rag/ # RAG implementation
โ โ โ โ โโโ ๐ generation/ # AI response generation
โ โ โ โ โโโ ๐ ingestion/ # Document processing
โ โ โ โ โโโ ๐ retrieval/ # Information retrieval
โ โ โ โโโ ๐ medical_agent.py # Main AI agent logic
โ โ โ โโโ ๐ symptom_checker.py # Symptom analysis
โ โ โโโ ๐ main.py # FastAPI application entry point
โ โโโ ๐ docker-compose.yml # Docker services configuration
โ โโโ ๐ Dockerfile # Backend container definition
โ โโโ ๐ requirements.txt # Python dependencies
โ โโโ ๐ .env.example # Environment variables template
โโโ ๐ client/ # React frontend application
โ โโโ ๐ public/ # Static assets
โ โโโ ๐ src/
โ โ โโโ ๐ api/ # API communication layer
โ โ โโโ ๐ components/ # Reusable React components
โ โ โโโ ๐ pages/ # Application pages
โ โ โโโ ๐ main.jsx # React entry point
โ โโโ ๐ package.json # Node.js dependencies
โ โโโ ๐ vite.config.js # Vite configuration
โโโ ๐ data/ # Medical knowledge base
โ โโโ ๐ medical_knowledge/
โ โโโ ๐ medlineplus_structured.json
โโโ ๐ DoctorSpecialistRecommend/ # Doctor recommendation system
โ โโโ ๐ Disease_Description.csv
โ โโโ ๐ Doctor_Specialist.csv
โ โโโ ๐ doctor_spec.py
โโโ ๐ README.md # Project documentation
โโโ ๐ CONTRIBUTING.md # Contribution guidelines
โโโ ๐ CODE_OF_CONDUCT.md # Community standards
โโโ ๐ LICENSE # MIT License
โโโ ๐ ROADMAP.md # Development roadmap
Before you begin, ensure you have the following installed:
Docker Desktop - Essential for running the containerized backend
Node.js 16+ - For frontend development
Git - Version control system
-
Clone the Repository
git clone https://github.com/CharithaReddy18/AI-health-chatbot.git cd AI-health-chatbot
-
Navigate to Backend Directory
cd backend
-
Configure Environment Variables
Create a
.env
file in thebackend
directory:cp .env.example .env
Edit the
.env
file and add your API keys:# Required: Google AI API Key GOOGLE_API_KEY=your_google_gemini_api_key_here # Optional: Alternative LLM providers GROQ_API_KEY=your_groq_api_key_here # Database Configuration QDRANT_URL=http://qdrant:6333 # Application Settings DEBUG=true
-
Build and Start Services (First Time)
docker-compose up --build
This command will:
- Build the FastAPI application container
- Download and start the Qdrant vector database
- Install all Python dependencies
- Initialize the medical knowledge base
-
Verify Backend is Running
Once the containers are up, verify the services:
- API Documentation: http://localhost:8000/docs
- API Health Check: http://localhost:8000/health
- Qdrant Dashboard: http://localhost:6333/dashboard
-
Navigate to Client Directory
cd client # From the project root directory
-
Install Dependencies
npm install
-
Start Development Server
npm run dev
-
Access the Application
Open your browser and navigate to http://localhost:5173
For future development sessions:
Backend:
cd backend
docker-compose up # No --build flag needed unless dependencies change
Frontend:
cd client
npm run dev
๐ก Pro Tip: If you modify
requirements.txt
, remember to rebuild withdocker-compose up --build
Variable | Description | Required | Default |
---|---|---|---|
GOOGLE_API_KEY |
Google Gemini API key for AI responses | โ Yes | None |
GROQ_API_KEY |
Alternative Groq API key | โ Optional | None |
QDRANT_URL |
Qdrant database connection URL | โ Optional | http://qdrant:6333 |
DEBUG |
Enable debug logging | โ Optional | false |
The application uses Pydantic for configuration management. Key settings include:
- Embedding Model:
sentence-transformers/all-MiniLM-L6-v2
- Vector Database: Qdrant with 384-dimensional embeddings
- LLM Temperature: Low temperature (0.0-0.3) for consistent medical responses
- Chunking Strategy: 500 characters with 50-character overlap
GROQ_API_KEY="YOUR_KEY_HERE"
HUGGINGFACE_API_KEY="YOUR_KEY_HERE"
-
Start the Application (both backend and frontend)
-
Navigate to the Symptom Checker in your browser
-
Test Knowledge-Based Queries (should use medical database):
"What are the common causes of a headache?" "I have a sore throat and fever. What could this be?" "Can you explain what diabetes is?"
-
Test Graceful Fallback Responses (for topics not in database):
"What's the best diet for weight loss?" "How can I improve my sleep quality?" "Can you suggest home remedies for stress?"
-
Verify Safety Disclaimers:
- Ensure every response ends with medical disclaimer
- Confirm bot never claims to be a real doctor
-
Test Emergency Scenarios:
"I'm having severe chest pain and shortness of breath" "My child has a very high fever and is unresponsive"
- Direct API Testing:
- Visit http://localhost:8000/docs
- Test the
POST /api/chat
endpoint - Example request body:
{ "query": "What are the symptoms of the flu?" }
- Natural Responses: Bot should never mention "context" or "documents"
- Consistent Disclaimers: Every response should include safety warnings
- Appropriate Fallbacks: Unknown topics should receive general wellness advice
- Professional Tone: Empathetic and helpful communication style
Primary chat endpoint for health queries.
Request Body:
{
"query": "string" // User's health question
}
Response:
{
"success": true,
"query": "What are the symptoms of the flu?",
"response": "The flu typically presents with...",
"sources": ["medical_knowledge"],
"processing_time": 1.23
}
System health check endpoint.
Response:
{
"status": "healthy",
"services": {
"api": "operational",
"vector_db": "connected",
"llm": "available"
}
}
- MedicalQueryRequest: Input validation for user queries
- MedicalQueryResponse: Structured response format
- SystemStatusResponse: Health check information
- โ Advanced RAG pipeline with Qdrant
- โ Google Gemini integration
- โ Human-like conversation prompts
- โ Docker containerization
- โ React frontend with modern UI
- ๐ Enhanced medical knowledge base
- ๐ Conversation memory and context
- ๐ User authentication and history
- ๐ Mobile-responsive design improvements
- ๐ฎ Multi-language support (Hindi, Spanish, etc.)
- ๐ฎ Voice input and output capabilities
- ๐ฎ Integration with wearable devices
- ๐ฎ Telemedicine appointment booking
- ๐ฎ Advanced symptom tracking
- ๐ฎ Personalized health recommendations
- ๐ฎ Integration with Electronic Health Records (EHR)
- ๐ฎ Real-time vital signs monitoring
- ๐ฎ AI-powered health trend analysis
- ๐ฎ Collaboration with healthcare providers
We welcome contributions from developers of all skill levels! MediBot is part of GirlScript Summer of Code (GSSoC) 2025, one of India's largest open-source programs.
- ๐ Bug Fixes: Help identify and resolve issues
- โจ New Features: Implement exciting new functionality
- ๐ Documentation: Improve guides and API docs
- ๐จ UI/UX: Enhance user experience and design
- ๐ง Performance: Optimize system efficiency
- ๐ Security: Strengthen data protection
- ๐งช Testing: Expand test coverage
- Fork the Repository: Click the fork button on GitHub
- Create a Branch:
git checkout -b feature/your-feature-name
- Make Changes: Implement your improvements
- Write Tests: Ensure your changes work correctly
- Submit PR: Create a pull request with clear description
- Follow the Contributing Guidelines
- Adhere to the Code of Conduct
- Ensure medical accuracy and safety in health-related changes
- Include tests for new functionality
- Update documentation as needed
Contributors will be:
- Listed in our Contributors section
- Eligible for GSSoC certificates and swag
- Recognized in release notes
- Invited to join our community discussions
- GirlScript Summer of Code (GSSoC) 2025 for providing an amazing platform for open-source collaboration
- Google AI for providing access to Gemini models
- The Medical Community for open medical datasets and knowledge sharing
- Open Source Contributors who make projects like this possible
This project serves as an excellent learning resource for:
- Modern full-stack development with Python and React
- Implementing RAG (Retrieval-Augmented Generation) systems
- Working with vector databases and semantic search
- Building responsible AI applications for healthcare
- Docker containerization and microservices architecture
This project is licensed under the MIT License - see the LICENSE file for details.
The MIT License allows for:
- โ Commercial use
- โ Modification
- โ Distribution
- โ Private use
->Thank you once again to all our contributors who has contributed to AI-health-chatbot! Your efforts are truly appreciated. ๐๐
![]() Nayini Charitha Reddy Project Maintainer |
![]() Anshi Agarwal Technical Mentor |
Thanks to all the amazing people who have contributed to MediBot:
If you find MediBot helpful, please consider:
- โญ Starring this repository
- ๐ฆ Sharing on social media
- ๐ฌ Telling friends and colleagues
- ๐ค Contributing to the project
- ๐ Providing feedback and suggestions
- ๐ Issues: GitHub Issues
- ๐ฌ Discussions: GitHub Discussions
- ๐ง Email: Contact maintainers for collaboration opportunities
- ๐ LinkedIn: Connect with the project team
Get Started Now | View Documentation | Join the Community
Built with โค๏ธ by the MediBot team and the amazing open-source community
Making healthcare information accessible, one conversation at a time ๐ฅโจ