A self-correcting medical AI agent built with LangGraph, Groq, ChromaDB, and Streamlit.
Combines retrieval-augmented generation (RAG) from a medical knowledge base with web search fallback and multimodal vision analysis for medical imaging.
- Agentic RAG Pipeline — A LangGraph-powered graph that retrieves, grades, and generates answers autonomously
- Self-Correction — If the internal knowledge base doesn't have a relevant answer, the agent automatically falls back to live web search
- Medical Vision Analysis — Upload X-Ray, MRI, or CT scan images for AI-powered visual analysis using Llama 4 Maverick
- Internal Knowledge Base — Indexed from The Gale Encyclopedia of Medicine (3rd Edition) using ChromaDB + HuggingFace embeddings
- Persistent Vector Store — ChromaDB is created once and reloaded on subsequent runs — no re-indexing needed
- Clean Dark UI — Custom Streamlit interface with a professional clinical theme
ClinixAI/
│
├── app.py # Streamlit UI — main entry point
├── agent.py # LangGraph agent graph definition
├── retriever.py # ChromaDB vector store setup & retriever
├── requirements.txt # Python dependencies
└── README.md
| Component | Technology |
|---|---|
| UI | Streamlit |
| Agent Orchestration | LangGraph |
| LLM (Reasoning) | Llama 3.3 70B via Groq |
| LLM (Vision) | Llama 4 Maverick 17B via Groq |
| Embeddings | sentence-transformers/all-MiniLM-L6-v2 (HuggingFace) |
| Vector Database | ChromaDB |
| PDF Loader | PyMuPDF |
| Web Search | DuckDuckGo (langchain-community) |
| Environment | Python 3.10+ |
git clone https://github.com/your-username/ClinixAI.git
cd ClinixAIpython -m venv venv
# Windows
venv\Scripts\activate
# macOS / Linux
source venv/bin/activatepip install -r requirements.txtCreate a .env file in the root directory:
GROQ_API_KEY=your_groq_api_key_hereGet your free Groq API key at console.groq.com.
Download The Gale Encyclopedia of Medicine (3rd Edition) from the following link and place it in the project root:
PDF Source:
The-Gale-Encyclopedia-of-Medicine-3rd-Edition.pdf
The vector database (
chroma_db_data/) will be created automatically on first run. This may take a few minutes. Subsequent runs load the existing database instantly.
streamlit run app.py| Action | How |
|---|---|
| Ask a clinical question | Type in the chat input and press Enter |
| Upload a medical image | Use the sidebar file uploader (JPG/PNG) |
| Combined query | Upload an image AND type a question — both are sent to the agent together |
| Clear conversation | Click 🗑 Clear Conversation in the sidebar |
Every response shows where the answer came from:
📄 Knowledge Base— answer retrieved from the Gale Encyclopedia PDF🌐 Web Search— knowledge base didn't have enough context, DuckDuckGo was used
