Medical AI ChatBot
Built a Generative AI medical chatbot that answers health questions and provides preliminary symptom assessment by grounding LLM responses in the Gale Encyclopedia of Medicine. The system ingests and chunks the source PDF, embeds it with HuggingFace sentence embeddings, and indexes it in Pinecone for semantic retrieval. LangChain orchestrates the retrieval-augmented generation pipeline against a locally-hosted Llama 3 model via Ollama, with concise, context-limited answers surfaced through both a classic Flask web UI and a modern Chainlit interface that maintains conversation history for follow-up questions.
Technologies Used
Problem Statement
People seeking preliminary medical information online are often confronted with unreliable sources or generic AI assistants prone to hallucinating symptoms, causes, or treatments. Without grounding in a trustworthy medical reference, LLM-based health assistants risk giving inaccurate or unsafe guidance while also raising privacy concerns around storing sensitive health data.
Solution
The Medical ChatBot anchors every response in the Gale Encyclopedia of Medicine rather than the model's parametric knowledge. By embedding the encyclopedia into a Pinecone vector store and retrieving the most relevant passages for each query, LangChain constrains the LLM to generate concise, three-sentence answers backed by retrieved context. Running inference through a local Ollama-hosted Llama 3 model keeps the system self-hostable and privacy-focused, since no user health data is stored, while dual Flask and Chainlit interfaces let it double as both a lightweight web widget and a full conversational assistant with follow-up memory.
Key Features
Retrieval-augmented generation grounded in the Gale Encyclopedia of Medicine
PDF ingestion and chunking pipeline with HuggingFace sentence embeddings
Pinecone vector search for semantic retrieval of relevant medical passages
Local LLM inference via Ollama (Llama 3) for privacy-focused deployment
Concise, context-limited answers to reduce hallucination risk
Dual interfaces: a Flask web UI and a Chainlit chat UI with conversation history
Engineering Challenges
Chunking a large medical reference PDF while preserving enough context for accurate retrieval
Constraining LLM answers to strictly reflect retrieved context rather than general medical knowledge
Balancing local LLM inference performance with response latency
Results & Metrics
Delivered grounded medical Q&A answers sourced directly from a trusted encyclopedia rather than model memory
Shipped two functional interfaces (Flask and Chainlit) from a shared retrieval backend
Kept the system privacy-focused by avoiding persistence of user health data
Lessons Learned
Grounding sensitive-domain chatbots in a single authoritative source materially reduces hallucination risk
Local LLM hosting via Ollama is a viable privacy-preserving alternative to cloud APIs for RAG applications
Supporting multiple UI frontends over one retrieval backend keeps the core RAG logic reusable