Medical RAG chatbot
Answers medical questions from a PDF knowledge base using FAISS retrieval and Mistral-7B.
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
- 01
PyPDF directory loader reads the PDF folder and splits it into 500-character chunks with 50-character overlap.
- 02
all-MiniLM-L6-v2 embeddings are stored in a FAISS index saved to disk and reloaded at query time.
- 03
RetrievalQA chain passes the top match into a prompt that limits answers to two or three lines from the context.
- 04
Jenkins runs in a Docker-in-Docker container, builds the image and archives a Trivy HIGH/CRITICAL report.
- 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.
L1Ingestion
- Medical PDFs
- PyPDF loader
- Recursive text splitter
L2Indexing
- MiniLM embeddings
- FAISS vector index
L3Serving
- Flask chat UI
- RetrievalQA chain
- Mistral-7B on HF endpoint
L4CI/CD
- Jenkins pipeline
- Trivy image scan
- Amazon ECR
L5Runtime
- AWS App Runner