This is a Retrieval-Augmented Generation (RAG) based chatbot designed to answer medical questions based on a provided set of documents. It's built with LangChain, Groq, and Streamlit.
Live Demo Link: https://medichat-bot.streamlit.app/
- Conversational AI: Ask medical questions in natural language.
- RAG Pipeline: Retrieves relevant information from medical documents to provide accurate, context-aware answers.
- Fast Inference: Powered by the high-speed Groq LPU™ Inference Engine.
- Built with Industry Standards: Modular code structure, dependency management, and ready for deployment.
The application follows a standard RAG architecture:
- Data Ingestion: Medical documents (PDFs) are loaded and split into chunks.
- Vector Store: Text chunks are converted into embeddings (using Hugging Face models) and stored in a FAISS vector store.
- Retrieval: When a user asks a question, the system retrieves the most relevant chunks from the vector store.
- Generation: The retrieved context and the user's question are passed to a Large Language Model (Groq's Llama4) to generate a final answer.
- Clone the repository:
git clone https://github.com/ihimanshu29/Medical-Chatbot.git
- Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
- Install dependencies:
pip install -r requirements.txt
- Set up environment variables:
- Create a
.envfile in the root directory. - Add your API keys to the
.envfile:HUGGINGFACE_API_KEY="your_hf_key" GROQ_API_KEY="your_groq_key"
- Create a
- Build the knowledge base:
(Ensure you have your PDF documents inside the
data/folder)python -m src.pipeline.training_pipeline
- Run the Streamlit app:
python -m streamlit run src/app.py
- Project Structure:
├── data/ │ └── medical_data.pdf ├── src/ │ ├── **init**.py │ ├── components/ │ │ ├── **init**.py │ │ ├── data_ingestion.py │ │ ├── llm_interface.py │ │ └── vector_store.py │ └── pipeline/ │ ├── **init**.py │ ├── prediction_pipeline.py │ └── training_pipeline.py ├── vectorstore/ │ └── db_faiss/ ├── app.py ├── config.py ├── .env ├── .gitignore ├── README.md └── requirements.txt