A medical question-answering chatbot leveraging Retrieval-Augmented Generation (RAG) for safe, context-aware responses using medical documents. Built with Streamlit, Hugging Face, FAISS, and PyTorch.
- Retrieval-Augmented Generation (RAG) for enhanced answer accuracy.
- Embedding medical documents using SentenceTransformers.
- Context-aware and memory-enabled conversation.
- Simple, interactive Streamlit web interface.
- Prioritizes user safety; does not answer out-of-context medical questions.
- Python 3.8+
- Streamlit for the UI
- PyTorch for deep learning
- Sentence-Transformers for text embeddings
- FAISS for vector search
- LangChain for prompt construction
- transformers for LLM pipelines
- Other: pandas, numpy, nltk, PyPDF2
- Python 3.8 or above
- pip (Python package manager)
- Medical data files (data/index.faiss,data/meta.csv)
- 
Clone the repository: git clone https://github.com/Thamannahafeez/medical-rag-chatbot.git cd medical-rag-chatbot
- 
Install dependencies: pip install -r requirements.txt 
- 
Place your FAISS index and metadata files in the data/folder.
Start the Streamlit app:
streamlit run app.pyThe app will be available at http://localhost:8501 by default.
| File/Folder | Description | 
|---|---|
| app.py | Main Streamlit application file | 
| requirements.txt | Python dependencies | 
| data/index.faiss | FAISS embedding index | 
| data/meta.csv | Chunk metadata for retrieval | 
- You can supply a FAISS index file containing embeddings and a corresponding metadata CSV in the data/directory. This repo contains proprietary medical data embedded from a PDF version of a medical textbook named "Gupte-The-Short-Textbook-of-Pediatrics-11th-Ed-2009" .
- The chatbot answers only using context from the uploaded documents. If the answer is not known or context is insufficient, it will refuse to respond or direct the user to a clinician.
- Do not use for clinical diagnosis or decision-making.
- Based on open-source RAG chatbot architectures and inspired by similar medical FAQ bots
- Uses components from HuggingFace, SentenceTransformers, and FAISS.