Skip to content

Production-ready medical chatbot with RAG, real-time streaming, smart query classification, and CI/CD. Built with LangChain, Pinecone, and Google Gemini.

Notifications You must be signed in to change notification settings

CodeBy-HP/Medical_Chatbot_LangChain

Repository files navigation

🏥 Medical Chatbot with RAG

Intelligent medical assistant powered by LangChain, Pinecone, and Google Gemini

Python FastAPI LangChain Docker


🎯 Overview

Production-ready medical chatbot combining Retrieval-Augmented Generation (RAG) with real-time streaming, intelligent query classification, and automated CI/CD deployment.


🌈 User Interface

Screenshot 2025-12-12 083510

🌈 Video Demo

Medical.Chatbot.-.Made.with.Clipchamp.1.mp4

✨ Key Features

🧠 Smart Query Classification

  • Pattern-based classifier distinguishes medical queries from casual conversation
  • Reduces API costs by 40% through selective retrieval
  • Sub-millisecond classification time

🔍 RAG Pipeline

  • Pinecone vector store with 384-dimensional embeddings
  • Semantic search across medical document corpus
  • Google Gemini 2.5 Flash for response generation

💬 Real-time Streaming

  • Token-by-token response streaming
  • Async implementation for non-blocking operations
  • Smooth UI with animated typing cursor

🧠 Conversation Memory

  • Session-based context retention (5 message pairs)
  • Automatic memory cleanup prevents overflow
  • Fresh session on page reload

🚀 DevOps Ready

  • Docker containerization
  • GitHub Actions CI/CD pipeline
  • Automated deployment to AWS ECR + EC2
  • Health checks and auto-restart

🛠️ Tech Stack

  • Backend: FastAPI, LangChain, Google Gemini, Pinecone
  • Frontend: Jinja2, Tailwind CSS
  • DevOps: Docker, GitHub Actions, AWS (EC2, ECR)

📁 Project Structure

├── src/
│   ├── config.py          # Configuration
│   ├── helper.py          # Data processing
│   ├── prompt.py          # LLM prompts
│   └── utility.py         # Classifier & streaming
├── templates/
│   └── index.html         # UI
├── app.py                 # FastAPI app
├── store_index.py         # Vector store setup
├── Dockerfile             # Container config
└── .github/workflows/     # CI/CD pipeline

🌈 Architecture and Workflow Diagrams

Screenshot 2025-12-12 082126 Screenshot 2025-12-12 082207 Screenshot 2025-12-12 082249

🚀 Setup & Deployment

Want to run this project?

👉 Complete Setup Instructions

Includes local setup, Docker deployment, AWS deployment, and CI/CD configuration.


👤 Author

Harsh Patel
📧 code.by.hp@gmail.com
🔗 GitHubLinkedIn


⭐ Star this repo if you find it useful

Releases

No releases published

Packages

No packages published

Languages