Medical Chatbot Using LLMs, LangChain, Pinecone, Flask & AWS

20 Jul

Authors: Abhishek Rai, Yashwant Saini, Hemant Kumar, Shivani, Assistant Professor Dr Iqbal

Abstract: The rapid advancement of artificial intelligence in healthcare has created new opportunities for automated medical assistance capable of supporting patients and easing the burden on healthcare professionals. Traditional rule-based and retrieval-based medical chatbots often suffer from limited contextual understanding, poor adaptability, and inability to provide reliable clinical insights. To address these limitations, this research introduces an advanced Medical Chatbot built using Large Language Models (LLMs), LangChain retrieval pipelines, Pinecone vector embeddings, Flask-based interface delivery, and AWS cloud infrastructure. The proposed system combines the reasoning ability of LLMs with domain-grounded medical knowledge through Retrieval-Augmented Generation (RAG), ensuring that responses remain accurate, context-sensitive, and aligned with verified medical literature. The chatbot processes user symptoms, queries, and health-related concerns, retrieves relevant medical information using vector similarity search, and generates human-like, medically aligned outputs. The modular architecture enables real-time interaction, low-latency retrieval, and highly scalable cloud deployment. Extensive experiments demonstrate strong performance across multiple evaluation criteria, including medical correctness, precision of retrieval, response quality, and system responsiveness. The chatbot achieved a medical accuracy rate exceeding 92%, with an average retrieval latency of under 120 ms, proving its suitability for real-world healthcare environments. This research highlights the transformative potential of LLM-driven medical assistants, capable of improving accessibility to preliminary medical guidance, reducing patient load in hospitals, and enhancing healthcare efficiency. The system further lays a foundation for future improvements in diagnostic reasoning, multilingual support, wearable device integration, and personalized health monitoring. Overall, this study demonstrates that integrating LLM intelligence with robust retrieval and cloud infrastructure provides a safe, scalable, and effective solution for next-generation digital healthcare systems.

DOI: https://doi.org/10.5281/zenodo.21455283