A production-ready, RAG-enhanced (Retrieval-Augmented Generation) medical assistant designed to provide accurate, context-aware information from clinical datasets.
- Intelligent Retrieval: Hybrid search combining BM25 (lexical) and MMR (semantic) dense retrieval.
- Multi-turn Conversation: Context-aware chat history management with pronoun resolution.
- Clinical Safety: Integrated safety triggers and disclaimers for sensitive medical queries.
- RAGAS Evaluated: High-performance metrics for answer relevancy and faithfulness.
- High Performance: Optimized with LLM rotation and connection pooling to handle rate limits.
- Backend: Flask (Python)
- Orchestration: LangChain
- LLM: Groq (Llama 3.3 70B)
- Vector Database: Pinecone
- Embeddings: BGE-Small-EN-V1.5 (HuggingFace)
- Testing: Pytest with environmental isolation mocking
- Python 3.11+
- Groq API Key
- Pinecone API Key
git clone https://github.com/kinza7124/medical-chatbot-ai.git
cd medical-chatbot-ai
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txtCreate a .env file in the root:
PINECONE_API_KEY=your_pinecone_key
GROQ_API_KEY=your_groq_key
FLASK_SECRET_KEY=your_secretpython app.pyThe app will be available at http://127.0.0.1:5000.
The project includes a robust test suite of 150+ cases.
pytest tests/ -vapp.py: Main Flask application and RAG pipeline.src/: Core logic for embeddings and data processing.tests/: Comprehensive unit, functional, and integration tests.docs/: Detailed SRS, Project Summary, and Testing documentation.
This chatbot is for informational purposes only and is not a substitute for professional medical advice, diagnosis, or treatment. Always seek the advice of your physician.