{"id":29544731,"url":"https://github.com/kunalmishravitb/medical-chatbot","last_synced_at":"2026-04-02T03:04:08.004Z","repository":{"id":302772287,"uuid":"1013552929","full_name":"kunalmishravitb/Medical-Chatbot","owner":"kunalmishravitb","description":"MediNeuron is an AI-powered medical chatbot leveraging Llama 2 and Pinecone to deliver precise, literature-based health insights through an interactive Flask app.","archived":false,"fork":false,"pushed_at":"2025-07-04T06:29:16.000Z","size":10978,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-17T16:02:26.319Z","etag":null,"topics":["flask","langchain","llama2","meta","pinecone","python","sentence-transformers","vector-database"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kunalmishravitb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-04T05:08:39.000Z","updated_at":"2025-07-04T06:30:42.000Z","dependencies_parsed_at":"2025-07-17T19:10:52.657Z","dependency_job_id":"875bd92b-a113-4a90-bcf4-49ec0e9e02da","html_url":"https://github.com/kunalmishravitb/Medical-Chatbot","commit_stats":null,"previous_names":["kunalmishravitb/medical-chatbot"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kunalmishravitb/Medical-Chatbot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kunalmishravitb%2FMedical-Chatbot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kunalmishravitb%2FMedical-Chatbot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kunalmishravitb%2FMedical-Chatbot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kunalmishravitb%2FMedical-Chatbot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kunalmishravitb","download_url":"https://codeload.github.com/kunalmishravitb/Medical-Chatbot/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kunalmishravitb%2FMedical-Chatbot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278838262,"owners_count":26054720,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flask","langchain","llama2","meta","pinecone","python","sentence-transformers","vector-database"],"created_at":"2025-07-17T16:00:55.064Z","updated_at":"2025-10-07T19:51:39.062Z","avatar_url":"https://github.com/kunalmishravitb.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🩺 MediNeuron: End-to-End Medical Chatbot using Llama 2\n\n## 📖 Project Overview\n\nDuring the pandemic, I encountered the challenge of finding reliable, understandable medical information online. Motivated by this, I developed an AI-powered Medical Chatbot to provide users with accurate medical responses sourced from trusted medical encyclopedias rather than scattered online content. This project integrates Meta’s Llama 2 model with a vector database to create a domain-specific chatbot capable of answering medical queries with precision.\n\n## ⚙️ How It Works\n\n* **Data Ingestion**: A medical encyclopedia PDF is collected as the knowledge base.\n* **Text Chunking**: The large document is split into overlapping text chunks to preserve context and fit model token limits.\n* **Embeddings Creation**: Chunks are converted into embeddings using sentence-transformers.\n* **Vector Database**: Embeddings are stored in Pinecone for fast similarity searches.\n* **Query Handling**:\n\n  * User queries are converted into embeddings.\n  * Pinecone retrieves relevant chunks.\n  * Retrieved text and the original query are fed into Llama 2 for generating context-aware answers.\n* **Model Optimization**: A quantized 7B parameter version of Llama 2 is used to reduce memory requirements while maintaining accuracy.\n* **Web Interface**: Built with Flask to provide an interactive user experience.\n\n## 🌐 Tech Stack\n\n* Python\n* Meta Llama2\n* LangChain\n* Pinecone\n* Flask\n* sentence-transformers\n\n## 🔒 Security\n\n* API keys and sensitive information are stored in a `.env` file to ensure security and prevent accidental exposure.\n\n## 📁 Project Structure\n\n```\nMEDICAL-CHATBOT/\n│\n├── data/\n│   └── Medical_book.pdf               # Medical encyclopedia PDF\n│\n├── model/\n│   └── llama-2-7b-chat.ggmlv3.q4_0.bin # Quantized Llama 2 model file\n│\n├── research/\n│   └── trials.ipynb                   # Jupyter notebook for experiments\n│\n├── src/\n│   ├── __init__.py\n│   ├── helper.py                      # Helper functions for processing\n│   ├── prompt.py                      # Prompt engineering utilities\n│\n├── static/\n│   ├── .gitkeep\n│   └── style.css                      # Custom CSS for web UI\n│\n├── templates/\n│   └── chat.html                      # HTML template for the chat UI\n│\n├── venv/                              # Virtual environment\n│\n├── .env                               # Environment variables (Pinecone keys)\n├── .gitignore                         # Git ignore file\n├── LICENSE                            # MIT License file\n├── app.py                             # Flask web application\n├── requirements.txt                   # Project dependencies\n├── setup.py                           # Setup script for packaging (if needed)\n├── store_index.py                     # Script to store embeddings in Pinecone\n├── template.py                        # Script for creating folder structure\n└── README.md                          # Project documentation\n```\n\n## 🚀 How to Run\n\n### Step 1: Clone the Repository\n\n```bash\ngit clone https://github.com/kunalmishravitb/Medical-Chatbot.git\ncd Medical-Chatbot\n```\n\n### Step 2: Create a Conda Environment\n\n```bash\nconda create -n venv python=3.10 -y\nconda activate venv\n```\n\n### Step 3: Install Dependencies\n\n```bash\npip install -r requirements.txt\n```\n\n### Step 4: Configure Environment Variables\n\nCreate a `.env` file in the root directory with:\n\n```\nPINECONE_API_KEY = \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"\nPINECONE_API_ENV = \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"\n```\n\n### Step 5: Download Llama 2 Model\n\n* Download the quantized model file:\n\n  * `llama-2-7b-chat.ggmlv3.q4_0.bin`\n  * From: [https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGML/tree/main](https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGML/tree/main)\n* Place the file in the `model/` directory.\n\n### Step 6: Build the Vector Index\n\n```bash\npython store_index.py\n```\n\n### Step 7: Launch the Web Application\n\n```bash\npython app.py\n```\n\nOpen your browser and navigate to:\n\n```\nhttp://localhost:5000\n```\n\n## 💡 Key Features\n\n* Retrieval-augmented chatbot delivering medical information grounded in actual medical literature.\n* Domain-specific insights rather than generic internet searches.\n* Efficient handling of large documents using chunking and embeddings.\n* Fast, scalable similarity searches via Pinecone.\n* Resource-optimized deployment using quantized models.\n\n## 🙌 Why This Matters\n\nThis project blends NLP, vector databases, and modern LLMs to make medical information more accessible and reliable. It transforms overwhelming medical research into conversational, user-friendly answers — a step toward bridging the gap between technology and human health concerns.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkunalmishravitb%2Fmedical-chatbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkunalmishravitb%2Fmedical-chatbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkunalmishravitb%2Fmedical-chatbot/lists"}