A modern medical question-answering chatbot that provides appropiate, relevant, and user-friendly medical information using a combination of retrieval-based methods and large language models.
- Hybrid Retrieval System: Combines MedQuAD dataset with Meditron LLM for accurate medical information
- Enhanced Responses: Uses Llama 3.1 (8B) to improve clarity and readability of medical information
- Entity Recognition: Highlights important medical terms and concepts
- Conversational Interface: Natural conversation capabilities for a better user experience
- Responsive Design: Clean, modern UI with Tailwind CSS
- Loading Indicators: Visual feedback during response generation
The application consists of two main components:
- Query Processing: Processes and optimizes user questions
- Entity Recognition: Identifies medical entities in text
- Retrieval Service: Searches the MedQuAD dataset for relevant information
- LLM Integration: Uses Meditron for medical knowledge and Llama 3.1 for response enhancement
- Conversation Service: Handles basic conversational interactions
- Chat Interface: Modern, responsive chat UI
- Message Formatting: Properly formats and displays medical information
- Entity Highlighting: Visually highlights medical terms
- Loading States: Provides visual feedback during processing
medical-qa-chatbot/
├── backend/ # FastAPI backend
│ ├── app/
│ │ ├── api/ # API endpoints
│ │ ├── services/ # Business logic
│ │ ├── utils/ # Utility functions
│ │ └── main.py # Application entry point
│ └── run.py # Server startup script
├── frontend/ # React frontend
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── services/ # API services
│ │ ├── types/ # TypeScript types
│ │ └── App.tsx # Main application component
│ └── index.html # HTML entry point
└── data/ # Data files and indexes
- Node.js (v16+)
- Python (v3.9+)
- Ollama (for running local LLMs)
-
Navigate to the backend directory:
cd backend
-
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Start the backend server:
python run.py
-
Navigate to the frontend directory:
cd frontend
-
Install dependencies:
npm install
-
Start the development server:
npm run dev
-
Install Ollama from https://ollama.ai/
-
Pull the required models:
ollama pull meditron:7b ollama pull llama3.1:8b
- Open your browser and navigate to
http://localhost:5173
- Type a medical question in the input field
- The system will:
- Process your question
- Search for relevant medical information
- Enhance the response for better readability
- Display the answer with highlighted medical terms
The chatbot provides different types of responses:
- Medical Information: Structured, concise answers to medical questions
- Conversational Responses: Natural replies to greetings and simple questions
- Not Available Responses: Clear indication when information is not available
- Frontend: React, TypeScript, Tailwind CSS, Vite
- Backend: FastAPI, Python
- LLMs: Meditron 7B, Llama 3.1 8B (via Ollama)
- Data: MedQuAD (Medical Question Answering Dataset)
This chatbot provides information based on the MedQuAD dataset and AI language models. It is not a substitute for professional medical advice, diagnosis, or treatment. Always consult with a qualified healthcare provider for medical concerns.