Lab build

Medical RAG chatbot

Answers medical questions from a PDF knowledge base using FAISS retrieval and Mistral-7B.

Role
Builder, end to end
Group
LLMOps and AIOps
Services
AI & LLM systems · MLOps & cloud

What it does

Medical reference PDFs are chunked, embedded with a MiniLM sentence-transformer and stored in a local FAISS index. A LangChain RetrievalQA chain sends the retrieved context to Mistral-7B-Instruct on a Hugging Face inference endpoint, and a Flask chat UI returns short, context-bound answers. A Jenkins pipeline builds the Docker image, scans it with Trivy, pushes it to Amazon ECR and redeploys an AWS App Runner service.

What was built

  1. 01

    PyPDF directory loader reads the PDF folder and splits it into 500-character chunks with 50-character overlap.

  2. 02

    all-MiniLM-L6-v2 embeddings are stored in a FAISS index saved to disk and reloaded at query time.

  3. 03

    RetrievalQA chain passes the top match into a prompt that limits answers to two or three lines from the context.

  4. 04

    Jenkins runs in a Docker-in-Docker container, builds the image and archives a Trivy HIGH/CRITICAL report.

  5. 05

    Final stage pushes the image to Amazon ECR and triggers a new AWS App Runner deployment.

The pipeline, layer by layer

Five layers, one pipeline.

  1. L1Ingestion

    • Medical PDFs
    • PyPDF loader
    • Recursive text splitter
  2. L2Indexing

    • MiniLM embeddings
    • FAISS vector index
  3. L3Serving

    • Flask chat UI
    • RetrievalQA chain
    • Mistral-7B on HF endpoint
  4. L4CI/CD

    • Jenkins pipeline
    • Trivy image scan
    • Amazon ECR
  5. L5Runtime

    • AWS App Runner

Stack

  • LangChain
  • FAISS
  • Hugging Face Hub
  • Mistral-7B-Instruct
  • sentence-transformers
  • PyPDF
  • Flask
  • Docker
  • Jenkins
  • Trivy
  • Amazon ECR
  • AWS App Runner

Next lab build · 02 / 46

Multi AI agent with web search

Chat agent that lets users pick a Groq Llama model and optionally enable Tavily web search.

Previous: Product price prediction with frontier LLM fine-tuning

Need a system like this in production? Tell us about it.