{"id":18667307,"url":"https://github.com/bmmunga/medguide-ai","last_synced_at":"2026-04-12T06:33:08.237Z","repository":{"id":251938672,"uuid":"838846908","full_name":"bmmunga/medguide-ai","owner":"bmmunga","description":" A Retrieval-Augmented Generation (RAG)-based AI assistant tailored for a hospital. It provides accurate, context-aware answers to patient queries by combining the hospital's medical knowledge base with a large language model (LLM). Ideal for answering FAQs, drug information, and hospital-specific guidelines.","archived":false,"fork":false,"pushed_at":"2025-02-14T13:16:12.000Z","size":318,"stargazers_count":0,"open_issues_count":3,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-02T08:39:11.021Z","etag":null,"topics":["chatbot","embeddings","generative-ai","nextjs","openai-api","openrouter-api","pinecone","reactjs","retrival-augmented-generation","similarity-search","streaming-data","tailwindcss","transformers","vector-database","vercel"],"latest_commit_sha":null,"homepage":"https://medguide-ai.vercel.app","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bmmunga.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2024-08-06T13:09:53.000Z","updated_at":"2025-02-14T13:16:15.000Z","dependencies_parsed_at":"2025-03-11T23:43:13.359Z","dependency_job_id":null,"html_url":"https://github.com/bmmunga/medguide-ai","commit_stats":null,"previous_names":["mungasoftwiz/medguide-ai","bmmunga/medguide-ai"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bmmunga/medguide-ai","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmmunga%2Fmedguide-ai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmmunga%2Fmedguide-ai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmmunga%2Fmedguide-ai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmmunga%2Fmedguide-ai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bmmunga","download_url":"https://codeload.github.com/bmmunga/medguide-ai/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmmunga%2Fmedguide-ai/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31706764,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-12T06:22:27.080Z","status":"ssl_error","status_checked_at":"2026-04-12T06:21:52.710Z","response_time":58,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["chatbot","embeddings","generative-ai","nextjs","openai-api","openrouter-api","pinecone","reactjs","retrival-augmented-generation","similarity-search","streaming-data","tailwindcss","transformers","vector-database","vercel"],"created_at":"2024-11-07T08:37:51.214Z","updated_at":"2026-04-12T06:33:08.206Z","avatar_url":"https://github.com/bmmunga.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# **MedGuide Hospital Chat Assistant**\n\n## **Overview**\nThe MedGuide Hospital Chatbot is an AI-powered assistant designed to provide accurate, concise, and helpful information about MedGuide Hospital, animaginary premier healthcare facility in Nairobi, Kenya. The chatbot answers questions about the hospital's services, specialties, staff, amenities, and other relevant details using a combination of **Pinecone** for vector-based search and **Meta Llama 3 70B Instruct** (via OpenRouter) for natural language understanding and response generation.\n\n---\n\n## **Features**\n- **Accurate Information**: Uses a knowledge base of hospital information to provide accurate answers.\n- **Concise Responses**: Keeps answers short and to the point (2-3 sentences).\n- **List Formatting**: Formats lists clearly, with each item on its own line.\n- **Streaming Responses**: Supports real-time streaming of responses for a better user experience.\n- **Customizable**: Easily extendable to include additional features or integrate with other systems.\n\n---\n\n## **Technologies Used**\n- **Frontend**: Next.js, React, Tailwind CSS\n- **Backend**: Next.js API Routes\n- **Vector Database**: Pinecone\n- **Embedding Model**: `Xenova/all-MiniLM-L6-v2`\n- **Language Model**: Meta Llama 3 70B Instruct (via OpenRouter)\n- **Deployment**: Vercel\n\n---\n\n## **Architecture: Retrieval-Augmented Generation (RAG)**\nThe MedGuide Hospital Chatbot employs a Retrieval-Augmented Generation (RAG) architecture to deliver accurate and contextually relevant responses. This architecture integrates retrieval-based methods with generative models, ensuring that answers are rooted in factual information from a knowledge base. The retrieval process involves converting user queries into embeddings using the `Xenova/all-MiniLM-L6-v2` model and performing a similarity search via `Pinecone`, a vector database, to fetch the most relevant text chunks from the hospital brochure data. These retrieved chunks are then combined with the user's query to form a contextual prompt for the generative model.\n\nThe generative phase utilizes the `meta-llama/llama-3.3-70b-instruct:free` model (accessed through `OpenRouter`) to synthesize concise and accurate responses based on the retrieved context and the user's query. This RAG approach offers several benefits, including enhanced accuracy by grounding responses in factual data, improved relevance through context-aware retrieval, scalability by allowing easy updates to the knowledge base without retraining the model, and flexibility in handling a wide range of queries by leveraging the retrieved context.\n\n![RAG Architecture](./docs/rag-architecture.png)\n\n---\n\n## **Getting Started**\n\n### **Prerequisites**\nBefore running the project, ensure you have the following installed:\n- Node.js (v18 or higher)\n- npm (v9 or higher)\n- A Pinecone account (for the vector database)\n- An OpenRouter API key (for the Meta Llama 3 70B Instruct model)\n\n---\n\n### **Installation**\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/your-username/medguide-chatbot.git\n   cd medguide-chatbot\n   ```\n\n2. Install dependencies:\n   ```bash\n   npm install\n   ```\n\n3. Set up environment variables:\n   - Create a `.env` file in the root directory:\n     ```env\n     PINECONE_API_KEY=your-pinecone-api-key\n     OPENROUTER_API_KEY=your-openrouter-api-key\n     ```\n   - Replace `your-pinecone-api-key` and `your-openrouter-api-key` with your actual API keys.\n\n4. Insert data into Pinecone:\n   - Run the initialization script to insert the hospital brochure data into Pinecone:\n     ```bash\n     npm run init-pinecone\n     ```\n\n---\n\n### **Running the Project**\n1. Start the development server:\n   ```bash\n   npm run dev\n   ```\n\n2. Open your browser and navigate to:\n   ```\n   http://localhost:3000\n   ```\n\n3. Interact with the chatbot by typing questions in the input box.\n\n---\n\n## **Project Structure**\n```\nmedguide-ai/\n├── app/\n│   ├── api/                  # API routes\n│   │   └── route.js          # Chatbot API endpoint\n│   |   └──pipeline.js        # Embedding pipeline\n│   ├── page.js               # Main page component\n│   └── scripts/\n│       └── init-pinecone.js  # Script to insert data into Pinecone\n├── public/                   # Static assets\n├── styles/                   # Global styles\n├── components                # UI functions\n├── .gitignore                # Git ignore file\n├── package.json              # Project dependencies\n└── README.md                 # Project documentation\n```\n\n---\n\n## **Configuration**\n### **Environment Variables**\nThe following environment variables are required:\n\n| Variable              | Description                          |\n|-----------------------|--------------------------------------|\n| `PINECONE_API_KEY`    | API key for Pinecone vector database |\n| `OPENROUTER_API_KEY`  | API key for OpenRouter (Meta Llama 3 70B Instruct) |\n\n---\n\n## **Usage**\n### **Chat Interface**\n1. Open the application in your browser.\n2. Type your question in the input box (e.g., \"What services does MedGuide Hospital offer?\").\n3. Press **Enter** or click the **Send** button to submit your question.\n4. The chatbot will respond with a concise and accurate answer.\n\n### **Example Queries**\n- **What are the visiting hours?**\n  ```\n  I don't know the specific visiting hours at MedGuide Hospital. However, I can tell you that the General OPD operates from Monday to Friday, 8:00 AM - 6:00 PM, and Emergency services are available 24/7.\n  ```\n\n- **Which doctors do you have at your hospital?**\n  ```\n  We have doctors specializing in various fields, including: - Cardiologists - Oncologists - Orthopedic surgeons - Neurologists - Dermatologists Note: For specific doctor names, I would recommend checking our website or contacting our administration for the most up-to-date information.\n  ```\n\n---\n\n## **Deployment**\nThe project is designed to be deployed on **Vercel**. Follow these steps to deploy:\n\n1. Push your code to a GitHub repository.\n2. Log in to your Vercel account and create a new project.\n3. Connect the GitHub repository to Vercel.\n4. Add the required environment variables (`PINECONE_API_KEY` and `OPENROUTER_API_KEY`) in the Vercel dashboard.\n5. Deploy the project.\n\n---\n\n## **Contributing**\nContributions are welcome! If you'd like to contribute, please follow these steps:\n1. Fork the repository.\n2. Create a new branch for your feature or bugfix:\n   ```bash\n   git checkout -b feature/your-feature-name\n   ```\n3. Commit your changes:\n   ```bash\n   git commit -m \"Add your commit message here\"\n   ```\n4. Push your branch:\n   ```bash\n   git push origin feature/your-feature-name\n   ```\n5. Open a pull request and describe your changes.\n\n---\n\n## **Acknowledgments**\n- **Pinecone**: For providing the vector database.\n- **OpenRouter**: For enabling access to the Meta Llama 3 70B Instruct model.\n- **Xenova**: For the `all-MiniLM-L6-v2` embedding model.\n- **Next.js**: For the framework.\n- **Vercel**: For the serverless deployment support.\n\n---\n\n## **Contact**\nFor questions or feedback, please contact:\n- **Boniface Munga**: [Email Me](mailto:mwachilumobm@gmail.com)\n- **GitHub**: [MungaSoftwiz](https://github.com/MungaSoftwiz)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbmmunga%2Fmedguide-ai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbmmunga%2Fmedguide-ai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbmmunga%2Fmedguide-ai/lists"}