How drdevastating/rag-based-medical-chatbot works
HaleAI is a medical-question answering application: a React interface sends requests to a FastAPI service, which delegates question processing to a RAG chatbot and returns answers with cited sources. The backend prepares PDF references as chunks and embeddings, retrieves candidates from a vector store, reranks them, and asks Gemini to generate a response. The UI also includes health status, analytics, source display, and a medical disclaimer. README documentation is not informative; some frontend request wiring and storage internals were not shown, so those connections are omitted.
Main entry points: chatbot.py Query orchestrator · data_processor.py PDF chunks and embeddings · App.jsx Chat and dashboard · llm_handler.py Gemini response generation
Components 11
Web client
- Chat and dashboard
frontend/src/App.jsx
API service
- FastAPI endpoints
backend/backend_server.py - Health and metrics
backend/backend_server.py
Medical RAG
- Query orchestrator
backend/chatbot.py - Reranking and context selection
backend/rag_processor.py - Gemini response generation
backend/llm_handler.py
Knowledge base
- Medical PDF corpus
backend/data - PDF chunks and embeddings
backend/data_processor.py - Vector retrieval
backend/vector_store.py
Other components
- Medical user
- Google Gemini
Connections 10
- Medical user → Chat and dashboard: asks question
frontend/src/App.jsx - Chat and dashboard → Health and metrics: checks health
frontend/src/App.jsx - FastAPI endpoints → Query orchestrator: delegates queries
backend/backend_server.py - Query orchestrator → PDF chunks and embeddings: initializes
backend/chatbot.py - Query orchestrator → Vector retrieval: retrieves candidates
backend/chatbot.py - Query orchestrator → Reranking and context selection: reranks candidates
backend/chatbot.py - Query orchestrator → Gemini response generation: generates answer
backend/chatbot.py - Medical PDF corpus → PDF chunks and embeddings: provides PDFs
- PDF chunks and embeddings → Vector retrieval: supplies embeddings
- Gemini response generation → Google Gemini: calls model