explaingit

anthony80188/medical-rag-chatbot

17TypeScriptAudience · developerComplexity · 3/5Setup · hard

TLDR

A portfolio RAG chatbot that answers medical questions using the MedQuAD FAQ dataset: it finds relevant passages with a vector database, then uses an AI model to write a concise answer of five sentences or fewer.

Mindmap

mindmap
  root((medical-rag-chatbot))
    How it works
      Vector search
      Passage retrieval
      AI answer generation
      5 sentence limit
    Tech stack
      Python backend
      FastAPI
      LangChain
      Qdrant
      React frontend
    Data
      MedQuAD dataset
      Medical FAQs
    Use cases
      Medical Q and A
      RAG reference impl
      Portfolio project
    Setup
      Run FastAPI server
      Run React dev server
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Ask plain-English medical questions and receive concise AI-generated answers sourced from the MedQuAD FAQ dataset

USE CASE 2

Use this project as a reference implementation for building a RAG pipeline with Qdrant, LangChain, and FastAPI

USE CASE 3

Study how to make an AI chatbot admit it does not know something instead of hallucinating an answer

Tech stack

PythonFastAPILangChainTypeScriptReactQdrantOpenAI

Getting it running

Difficulty · hard Time to first run · 1h+

Requires an OpenAI API key, a running Qdrant instance, and two separate servers (FastAPI backend and React frontend) started independently.

No license information was provided in the explanation.

In plain English

This is a medical question-answering chatbot built as a portfolio or learning project. You type a medical question, and it responds with a short, factual answer drawn from a curated dataset of medical FAQs called MedQuAD. The chatbot uses a technique called Retrieval-Augmented Generation (RAG). When you ask a question, it first searches through the MedQuAD dataset to find the most relevant passages using a vector database called Qdrant. A vector database finds passages that are semantically similar to your question rather than just matching keywords. The retrieved passages are then handed to a language model (via the OpenAI API), which uses them as context to write a concise answer. The prompt instructs the model to keep answers to five sentences or fewer and to say it does not know if the retrieved context does not contain enough information. The backend is written in Python using FastAPI (a framework for building web APIs quickly) and LangChain (a library for connecting language models to other data sources and tools). The frontend is a React web application built on a modified chatbot-UI template, using Radix-UI components and the Vite build tool. The two parts are run separately: you start the FastAPI server in the backend directory and start the React development server in the frontend directory. The README includes several screenshots showing example conversations, including questions about celiac disease, saturated fats, fatigue, and a case where someone asks about Microsoft Office, which the bot correctly deflects as outside its domain. The project is written primarily in TypeScript on the frontend and Python on the backend.

Copy-paste prompts

Prompt 1
I cloned medical-rag-chatbot and want to replace the MedQuAD dataset with my own FAQ CSV. Walk me through ingesting my data into Qdrant and updating the retrieval step in the FastAPI backend.
Prompt 2
The medical-rag-chatbot limits answers to 5 sentences. I want to change that limit and also add a 'sources' section showing which MedQuAD entries were retrieved. Show me the prompt and API changes needed.
Prompt 3
Help me deploy the medical-rag-chatbot backend to a free hosting service. The backend uses FastAPI and needs environment variables for the OpenAI API key and Qdrant URL.
Prompt 4
I want to swap out OpenAI for a local Ollama model in the medical-rag-chatbot. Which file do I edit and what LangChain class do I replace?
Prompt 5
Write a test script that sends 5 sample medical questions to the running medical-rag-chatbot API and prints each question, the retrieved passages, and the final answer.
Open on GitHub → Explain another repo

← anthony80188 on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.