Skip to content

salonyranjan/MediQuery.ai

Repository files navigation

🩺 MediQuery.ai: Advanced Medical RAG Chatbot

Python 3.10 LangChain AWS ECR Docker

MediQuery.ai is a professional-grade medical assistant built using a Retrieval-Augmented Generation (RAG) architecture. It answers questions based on your indexed medical documents instead of raw LLM hallucinations, improving accuracy and trustworthiness.


πŸ“Š Live Project Dashboard

Real-time status of the MediQuery.ai ecosystem:

Service Status Description
CI/CD Pipeline Build Status Automated Build & Deploy via GitHub Actions
Backend API API Status Flask Server running on AWS EC2
Vector DB Pinecone Medical Index: medical-chatbot
Inference Engine Groq Real-time Neural Inference
Deployment AWS Deployment Live Production Environment

Live Production URL: http://13.60.62.104:8080


πŸ“Έ Demo Showcase

Modern, responsive UI with Dark Mode toggle for optimal readability.

πŸŒ™ Dark Mode (Default) β˜€οΈ Light Mode
MediQuery AI Dark Mode MediQuery AI Light Mode

πŸš€ Key Features

  • Context‑aware answers:
    Powered by LangChain and Groq (Llama‑3.3‑70B) for fast, accurate medical reasoning grounded in your documents.
  • Semantic search:
    Uses Pinecone for real‑time similarity search over embedded medical text.
  • Modern UI:
    Clean, responsive Flask frontend with Dark Mode, glassmorphism, and real‑time thinking indicators.
  • Automated deployment:
    Fully integrated CI/CD pipeline (GitHub Actions β†’ AWS ECR β†’ EC2/Docker).

πŸ› οΈ Tech Stack

Category Technology
LLM Framework LangChain
Large Language Model Groq (llama3-70b-8192)
Vector Database Pinecone
Embeddings HuggingFace (all-MiniLM-L6-v2)
Backend Flask (Python 3.10)
Frontend HTML5, CSS3, JavaScript (AJAX)
Cloud / DevOps AWS (EC2, ECR), Docker, GitHub Actions

πŸ“‚ Project Structure

.
β”œβ”€β”€ app.py              # Flask app (routes & RAG logic)
β”œβ”€β”€ store_index.py      # Script to populate Pinecone index
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ helper.py       # Helper functions (embeddings, utils)
β”‚   └── prompt.py       # System / RAG prompts
β”œβ”€β”€ assets/             # Screenshots (linked above)
β”œβ”€β”€ static/             # CSS / JS, images (Dark Mode styles)
β”œβ”€β”€ templates/          # HTML templates (chat.html)
β”œβ”€β”€ requirements.txt    # Python dependencies
β”œβ”€β”€ Dockerfile          # Docker build config
└── .github/workflows   # GitHub Actions CI/CD workflows

πŸš€ How to Run Locally

  1. Clone the repository

    git clone https://github.com/salonyranjan/MediQuery.ai.git
    cd MediQuery.ai
  2. Create a conda environment

    conda create -n medibot python=3.10 -y
    conda activate medibot
  3. Install dependencies

    pip install -r requirements.txt
  4. Create .env file

    Create .env in the root directory and add:

    PINECONE_API_KEY=xxxxxxxxxxxxxxxx
    OPENAI_API_KEY=xxxxxxxxxxxxxxxx
    GROQ_API_KEY=xxxxxxxxxxxxxxxx
    

    Replace values with your actual API keys.

  5. Build the vector index

    python store_index.py
  6. Run the app

    python app.py

    Open your browser:http://localhost:8080

text


🐳 Docker Quick Start (no conda)

If you prefer running via Docker:

# 1. Build the image
docker build -t mediquery .

# 2. Run the container
docker run -d -p 8080:8080 \
-e PINECONE_API_KEY="xxxxxxxxxxxxxxxx" \
-e GROQ_API_KEY="xxxxxxxxxxxxxxxx" \
--name mediquery_app \
mediquery

Then open:http://localhost:8080


πŸš€ AWS Deployment Overview (EC2 + Docker + GitHub Actions)

  1. Login to AWS Console
    Go to https://aws.amazon.com and sign in.

  2. Create an IAM user for deployment

    • Attach policies:
      • AmazonEC2ContainerRegistryFullAccess
      • AmazonEC2FullAccess
    • Save the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.
  3. Create an ECR repository

    Example (replace with your account and region):

    315865595366.dkr.ecr.us-east-1.amazonaws.com/medicalbot
    
  4. Launch an EC2 instance (Ubuntu)

    • Choose an Ubuntu AMI (e.g., ubuntu/focal).
    • Attach a key pair and security group allowing port 8080.
  5. Install Docker on EC2

    sudo apt-get update -y
    sudo apt-get upgrade -y
    
    curl -fsSL https://get.docker.com -o get-docker.sh
    sudo sh get-docker.sh
    sudo usermod -aG docker ubuntu
    newgrp docker
  6. Configure EC2 as a self‑hosted GitHub Actions runner

    • In GitHub: Settings β†’ Actions β†’ Runners β†’ New self‑hosted runner.
    • Choose Linux and run the provided commands on your EC2 machine.
  7. Add GitHub Secrets

    In your repo: Settings β†’ Secrets and variables β†’ Actions.

    Add:

    • AWS_ACCESS_KEY_ID
    • AWS_SECRET_ACCESS_KEY
    • AWS_DEFAULT_REGION (e.g., eu-north-1)
    • ECR_REPO (e.g., 577435557871.dkr.ecr.eu-north-1.amazonaws.com/medical_chatbot)
    • PINECONE_API_KEY
    • OPENAI_API_KEY
    • GROQ_API_KEY

Once GitHub Actions runs, it will:

  • Build and push the Docker image to ECR.
  • Deploy it to EC2 via docker pull and docker run.
  • Expose the app on port 8080.

About

MediQuery.ai β€” A Production-Grade Medical RAG Pipeline. Built with LangChain, Groq (Llama-3), and Pinecone. Fully containerized with Docker and deployed on AWS (EC2/ECR) using GitHub Actions CI/CD. πŸ©ΊπŸ€–

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors