Skip to content

mohitsoniii/HealthMate-AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚕️ HealthMate AI — Healthcare Assistant

A production-ready GenAI healthcare assistant built with Python, Streamlit, Groq, LangChain, FAISS, and Sentence Transformers.

Python Streamlit LangChain Groq FAISS License


🚀 Features

Feature Technology
📄 PDF Medical Report Upload PyMuPDF / pdfplumber / pypdf
🧠 Semantic Search (RAG) FAISS + Sentence Transformers
🤖 Context-Aware Q&A LangChain + Groq (Llama 3, Mixtral, etc.)
📋 Auto Report Summary Structured LLM Summarization
⚡ Cloud-Powered AI Groq ultra-fast inference (free tier available)
💬 Multi-turn Chat Streamlit Session State
🔄 Ollama Fallback Optional local inference via Ollama

🏗️ Architecture

User Upload (PDF)
      │
      ▼
┌─────────────────┐
│  PDF Processor  │ ──► PyMuPDF / pdfplumber / pypdf
└────────┬────────┘
         │ raw text
         ▼
┌─────────────────────────┐
│  RAG Pipeline           │
│  ┌─────────────────┐   │
│  │ Text Chunker    │   │ ──► Sliding window (400 words, 80 overlap)
│  └────────┬────────┘   │
│           │ chunks      │
│  ┌────────▼────────┐   │
│  │ Sentence Trans. │   │ ──► all-MiniLM-L6-v2 embeddings
│  └────────┬────────┘   │
│           │ vectors     │
│  ┌────────▼────────┐   │
│  │ FAISS Index     │   │ ──► IndexFlatIP (cosine similarity)
│  └─────────────────┘   │
└─────────────────────────┘
         │
         │ User Query
         ▼
┌─────────────────┐
│  Retriever      │ ──► Top-k similar chunks
└────────┬────────┘
         │ context + query
         ▼
┌─────────────────┐
│  LLM Handler    │ ──► Groq API (primary) / Ollama (fallback)
└────────┬────────┘
         │ answer
         ▼
┌─────────────────┐
│  Streamlit UI   │ ──► Chat interface with source display
└─────────────────┘

⚡ Quick Start

Prerequisites

1. Clone the repository

git clone https://github.com/yourusername/healthmate-ai.git
cd healthmate-ai

2. Install dependencies

pip install -r requirements.txt

3. Configure your API key

Copy the secrets template and add your Groq API key:

cp .streamlit/secrets.toml.example .streamlit/secrets.toml

Then edit .streamlit/secrets.toml and replace your-groq-api-key-here with your actual key.

4. Run the app

streamlit run app.py

Open http://localhost:8501 in your browser.

(Optional) Local Ollama Fallback

If you prefer local inference or want a fallback, install Ollama and pull a model:

ollama serve
ollama pull llama3

The app will automatically detect and offer Ollama models if available.


📁 Project Structure

healthmate-ai/
├── app.py                    # Main Streamlit application
├── requirements.txt          # Python dependencies
├── LICENSE                   # MIT License
├── .gitignore
├── .streamlit/
│   ├── config.toml           # Streamlit theme config
│   └── secrets.toml.example  # API key template
├── assets/
│   └── style.css             # Custom UI styling
├── utils/
│   ├── __init__.py
│   ├── pdf_processor.py      # PDF text extraction (multi-strategy)
│   ├── rag_pipeline.py       # FAISS + Sentence Transformers RAG
│   ├── llm_handler.py        # Groq / Ollama LLM integration
│   └── report_analyzer.py    # Report summarization logic
├── models/
│   └── all-MiniLM-L6-v2/    # (gitignored) local embedding model
└── data/
    └── sample_reports/       # (gitignored) sample PDFs for testing

🔧 Configuration

Edit .streamlit/config.toml to change theme colors.

Change the embedding model in utils/rag_pipeline.py:

model_name = "sentence-transformers/all-MiniLM-L6-v2"  # fast, lightweight
# or
model_name = "sentence-transformers/all-mpnet-base-v2"  # more accurate, slower

🛡️ Disclaimer

HealthMate AI is for informational and educational purposes only. It is not a substitute for professional medical advice, diagnosis, or treatment. Always consult a qualified healthcare provider.


🧑‍💻 Tech Stack

  • Frontend: Streamlit
  • LLM Orchestration: LangChain
  • Cloud LLM: Groq API (Llama 3, Mixtral, Gemma 2, etc.)
  • Local LLM (optional): Ollama
  • Embeddings: Sentence Transformers (all-MiniLM-L6-v2)
  • Vector Store: FAISS (CPU)
  • PDF Parsing: PyMuPDF, pdfplumber, pypdf (cascading fallback)
  • Language: Python 3.10+

Built with ❤️ as a portfolio project demonstrating production-grade GenAI engineering.

About

An intelligent, fast healthcare companion app using RAG (Retrieval-Augmented Generation). Upload PDF medical reports (blood tests, prescriptions, lab results) and get instant, structured summaries and context-aware Q&A explanations powered by Streamlit, Groq API, FAISS, and Sentence Transformers.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors