A curated collection of practical AI projects implementing OCR systems, RAG, AI agents, and other AI use cases.
π₯ Clinical RAG with ADE
Query dense clinical PDFs and get answers grounded in the document's exact visual layout.

Overview
Clinical documents like trial results, lab reports, and prescribing information are difficult for traditional RAG systems to process. Standard PDF parsers "flatten" the text, destroying the structure of multi-column layouts and dense medical tables.
This project solves the Ingestion Bottleneck by using LandingAIβs Agentic Document Extraction (ADE). ADE treats documents as visual artifacts, preserving hierarchical headers and complex tables as structured Markdown. By combining this with Mistral Largeβs superior reasoning and ChromaDB, medical professionals can query dense PDFs and receive answers that are strictly grounded in the document's visual layout.
Features
- Visual-First Parsing: Utilizes LandingAI ADE to extract semantic chunks while preserving the integrity of medical tables.
- Markdown-Based Retrieval: Ensures the LLM "sees" tables in their original structure rather than unordered text strings.
- Visual Grounding: Every retrieved chunk includes normalized bounding box coordinates (
bbox) and page numbers. - Mistral Reasoning: Uses
mistral-large-latestto perform complex reasoning over clinical data. - Audit Trails: A "Source Evidence" panel in the UI allows users to trace every answer back to its exact location in the source PDF.
- Session Management: Built-in functionality to clear clinical data and switch between documents securely.
Tech Stack
Frameworks & Libraries:
- LangChain: Orchestration of the RAG pipeline.
- LandingAI ADE: Agentic Document Extraction for structured parsing.
- Mistral AI:
mistral-embedfor vectorization andmistral-large-latestfor reasoning. - Vector Database: ChromaDB.
- Web Framework: Streamlit.
- Package Manager: uv.
Prerequisites
Before you begin, ensure you have:
- Python 3.12 or higher.
- uv installed on your machine.
- API keys for:
- LandingAI (
VISION_AGENT_API_KEY) - Mistral AI (
MISTRAL_API_KEY)
- LandingAI (
Installation
1. Clone the Repository
git clone https://github.com/Sumanth077/Hands-On-AI-Engineering.git
cd Hands-On-AI-Engineering/rag_apps/clinical_rag_with_ade
2. Install Dependencies
Using uv, simply run the sync command. This will create a virtual environment and install all required packages from the lockfile:
uv sync
3. Set Up Environment Variables
Copy the example environment file and fill in your keys:
cp .env.example .env
Edit .env:
VISION_AGENT_API_KEY=your_landingai_key_here
MISTRAL_API_KEY=your_mistral_key_here
Usage
Running the Application
To start the clinical dashboard:
uv run streamlit run app.py
Example Workflow
- Upload: Drop a clinical trial PDF (e.g., NEJM results) into the sidebar.
- Ingest: Click "π Process" to trigger ADE visual parsing and ChromaDB indexing.
- Query: Ask: "What was the incidence of Grade 3 adverse events in the 50mg cohort?"
- Verify: Expand the "π Source Evidence" to see the Markdown table and the bounding box coordinates pointing to the exact page.
- Reset: Use the "ποΈ Clear All" button to wipe the local database and upload a new study.
Project Structure
clinical_rag_with_ade/
βββ app.py # Streamlit UI with Visual Grounding panel
βββ processor.py # Core RAG Logic (ADE Parsing, Indexing, Mistral Query)
βββ schemas.py # Pydantic models for Document Chunks
βββ .env # API Keys (Git ignored)
βββ pyproject.toml # uv project configuration
βββ chroma_db/ # Local persistent vector database (Auto-generated)
How It Works

Technical Details:
- Visual-First Ingestion:
processor.pysends the PDF to LandingAI'sdpt-2-latestmodel. It returns Markdown + Grounding metadata. - Preserved Hierarchy: Instead of splitting by character count, the system indexes semantic units (chunks). A full table is kept as a single unit to maintain context.
- Reflective Retrieval: LangChain's
VectorStoreRetrieverfetches the top-K chunks. These are enriched with metadata (page, bbox) before being sent to the LLM. - Grounded Reasoning: Mistral Large receives a system prompt instructing it to answer only using the provided context, referencing page numbers for high-stakes medical accuracy.