--- title: Agentic RagBot emoji: πŸ₯ colorFrom: blue colorTo: indigo sdk: docker pinned: true license: mit app_port: 7860 tags: - medical - biomarker - rag - healthcare - langgraph - agents short_description: Multi-Agent RAG System for Medical Biomarker Analysis --- # πŸ₯ MediGuard AI β€” Medical Biomarker Analysis A production-ready **Multi-Agent RAG System** that analyzes blood test biomarkers using 6 specialized AI agents with medical knowledge retrieval. ## ✨ Features - **6 Specialist AI Agents** β€” Biomarker validation, disease prediction, RAG-powered analysis, confidence assessment - **Medical Knowledge Base** β€” 750+ pages of clinical guidelines (FAISS vector store) - **Evidence-Based** β€” All recommendations backed by retrieved medical literature - **Free Cloud LLMs** β€” Uses Groq (LLaMA 3.3-70B) or Google Gemini ## πŸš€ Quick Start 1. **Enter your biomarkers** in any format: - `Glucose: 140, HbA1c: 7.5` - `My glucose is 140 and HbA1c is 7.5` - `{"Glucose": 140, "HbA1c": 7.5}` 2. **Click Analyze** and get: - Primary diagnosis with confidence score - Critical alerts and safety flags - Biomarker analysis with normal ranges - Evidence-based recommendations - Disease pathophysiology explanation ## πŸ”§ Configuration This Space requires at least one LLM API key. Configure secrets in **Space Settings β†’ Secrets**. ### Required Secrets (pick one) | Secret | Provider | Description | Get Free Key | |--------|----------|-------------|--------------| | `GROQ_API_KEY` | Groq | **Recommended** - Fast, free LLaMA 3.3-70B | [console.groq.com/keys](https://console.groq.com/keys) | | `GOOGLE_API_KEY` | Google Gemini | Free Gemini 2.0 Flash | [aistudio.google.com](https://aistudio.google.com/app/apikey) | ### Optional: LLM Configuration | Secret | Default | Description | |--------|---------|-------------| | `GROQ_MODEL` | `llama-3.3-70b-versatile` | Groq model to use | | `GEMINI_MODEL` | `gemini-2.0-flash` | Gemini model to use | | `LLM_PROVIDER` | auto-detected | Force provider: `groq` or `gemini` | ### Optional: Embeddings | Secret | Default | Description | |--------|---------|-------------| | `EMBEDDING_PROVIDER` | `huggingface` | Provider: `jina`, `google`, or `huggingface` | | `JINA_API_KEY` | - | High-quality 1024d embeddings ([jina.ai](https://jina.ai/)) | ### Optional: Observability (Langfuse) | Secret | Description | |--------|-------------| | `LANGFUSE_ENABLED` | Set to `true` to enable tracing | | `LANGFUSE_PUBLIC_KEY` | Langfuse public key | | `LANGFUSE_SECRET_KEY` | Langfuse secret key | | `LANGFUSE_HOST` | Langfuse host URL (e.g., `https://cloud.langfuse.com`) | ## πŸ—οΈ Architecture ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Clinical Insight Guild β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ 1. Biomarker Analyzer β”‚ β”‚ β”‚ β”‚ Validates values, flags abnormalities β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β–Ό β–Ό β–Ό β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ Disease β”‚ β”‚Biomarker β”‚ β”‚ Clinical β”‚ β”‚ β”‚ β”‚Explainer β”‚ β”‚ Linker β”‚ β”‚Guidelinesβ”‚ β”‚ β”‚ β”‚ (RAG) β”‚ β”‚ β”‚ β”‚ (RAG) β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β–Ό β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ 4. Confidence Assessor β”‚ β”‚ β”‚ β”‚ Evaluates reliability, assigns scores β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β–Ό β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ 5. Response Synthesizer β”‚ β”‚ β”‚ β”‚ Compiles patient-friendly summary β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` ## πŸ“Š Supported Biomarkers | Category | Biomarkers | |----------|------------| | **Diabetes** | Glucose, HbA1c, Fasting Glucose, Insulin | | **Lipids** | Cholesterol, LDL, HDL, Triglycerides | | **Kidney** | Creatinine, BUN, eGFR | | **Liver** | ALT, AST, Bilirubin, Albumin | | **Thyroid** | TSH, T3, T4, Free T4 | | **Blood** | Hemoglobin, WBC, RBC, Platelets | | **Cardiac** | Troponin, BNP, CRP | ## ⚠️ Medical Disclaimer This tool is for **informational purposes only** and does not replace professional medical advice, diagnosis, or treatment. Always consult a qualified healthcare provider with questions regarding a medical condition. ## πŸ“„ License MIT License β€” See [GitHub Repository](https://github.com/yourusername/ragbot) for details. ## πŸ™ Acknowledgments Built with [LangGraph](https://langchain-ai.github.io/langgraph/), [FAISS](https://faiss.ai/), [Gradio](https://gradio.app/), and [Groq](https://groq.com/).