This application is a Medical Domain Chatbot built using Retrieval-Augmented Generation (RAG). It allows users to upload their own medical documents (e.g., textbooks, reports), and the system intelligently answers queries by retrieving the most relevant content before generating a final response.
RAG (Retrieval-Augmented Generation) enhances language models by supplying relevant external context from a knowledge base, preventing hallucinations and improving accuracy, especially for factual or specialized domains like medicine.
User Input
↓
Query Embedding → Pinecone Vector DB ← Embedded Chunks ← Chunking ← PDF Loader
↓
Retrieved Docs
↓
RAG Chain (Groq + LangChain)
↓
LLM-generated Answer
- Upload medical PDFs (notes, books, etc.)
- Auto-extracts text and splits into semantic chunks
- Embeds using HuggingFace Sentence-transformers embeddings
- Stores vectors in Pinecone DB
- Uses Groq's openai/gpt-oss-120b via LangChain
- FastAPI backend with endpoints for file upload and Q&A
| Component | Tech Used |
|---|---|
| LLM | Groq API (openai/gpt-oss-120b) |
| Embeddings | HuggingFace Sentence-transformers |
| Vector DB | Pinecone |
| Framework | LangChain |
| Backend | FastAPI |
| Deployment | Render |
POST /upload_pdfs/ --- Upload one or more PDF files
POST /ask/ --- Ask a question --- Form field: `question`
# Clone the repo
$ git clone https://github.com/Ganesh153/MedicalChatbot.git
$ cd medicalAssistant/backend
# Create virtual env
$ uv venv
$ .venv/bin/activate # Windows: venv\Scripts\activate
# Install dependencies
$ uv pip install -r requirements.txt
# Set environment variables (.env)
GROQ_API_KEY=...
PINECONE_API_KEY=...
PINECONE_INDEX_NAME=...
# Run the server
$ uvicorn main:app --reload --port 8000
# Frontend
$ cd medicalAssistant/frontend
# Create virtual env
$ uv venv
$ .venv/bin/activate # Windows: venv\Scripts\activate
# Install dependencies
$ uv pip install -r requirements.txt
# Run the server
$ streamlit run app.py-
Hosted on Render
-
Configure
start commandas:uvicorn main:app --host 0.0.0.0 --port 10000
- Built by Ganesh
- Inspired by LangChain, Groq, Pinecone, and FastAPI ecosystems
This project is licensed under the MIT License.