Production Case Study · RAG · Vector Search · MCP · Offline AI

Offline Medical RAG System
Harrison's Textbook Q&A Engine

A 100% offline retrieval-augmented generation system indexing 2,000+ pages of Harrison's Principles of Internal Medicine. Every answer is grounded in retrieved document passages with full citation — no cloud API, no data leaves the machine.

2,000+
Pages indexed
~3,000
Document chunks in ChromaDB
6
Custom MCP servers
100%
Offline — zero cloud API calls
Cited
Source-referenced answers
Offline Medical RAG System — Harrison's Textbook Q&A Engine screenshot
System Architecture

How the Offline RAG Pipeline Works

The system uses a standard RAG pipeline — ingest, embed, store, retrieve, generate — but runs every component locally. No data is sent to cloud APIs at any stage, making it suitable for sensitive or privacy-constrained environments.

📚

Document Ingestion

Harrison's Principles of Internal Medicine (2,000+ pages) is parsed, cleaned, and split into approximately 3,000 overlapping chunks using LangChain's text splitters. Chunk boundaries are optimized for medical context preservation.

🔢

Local Embeddings (Mistral 7B via Ollama)

Chunks are embedded using Mistral 7B running locally via Ollama — no OpenAI API, no cloud embedding service. The embedding model runs on local hardware, ensuring full data privacy during the indexing phase.

🗃️

ChromaDB Vector Store

All 3,000 embeddings are stored in ChromaDB, an open-source local vector database. At query time, ChromaDB performs approximate nearest neighbor search to retrieve the top-k most semantically relevant chunks in milliseconds.

🔧

6 Custom FastMCP Servers

Six FastMCP servers expose retrieval operations as callable tools: chapter-level retrieval, symptom-based search, drug information lookup, diagnostic criteria retrieval, treatment protocol search, and citation resolution.

🤖

Local LLM Inference (Mistral 7B)

The same Mistral 7B model used for embeddings performs generation — ensuring consistent semantic space. Retrieved chunks are provided as context, and the model generates grounded answers without hallucinating content not in the retrieved passages.

📎

Citation-Backed Retrieval

Every generated answer includes citations — chapter, section, and passage references — so users can verify the source in the original textbook. Critical for medical use cases where answer provenance must be auditable.

Technology Stack

ChromaDB FastMCP Ollama Mistral 7B LangChain Python Vector Search Embeddings RAG Local LLM

Questions About RAG and This System

What is a RAG system and how does it work?
RAG (Retrieval-Augmented Generation) grounds a language model's answers in retrieved document passages. When you ask a question, the system embeds your query, searches the vector database for the most relevant document chunks, and passes those chunks as context to the LLM — which generates a grounded answer. This prevents hallucination and makes the model's knowledge updatable without retraining.
Why would you run a RAG system completely offline?
Offline RAG is essential when data sensitivity prevents sending information to cloud APIs — in healthcare, legal, defense, or enterprise environments where data cannot leave the premises. An offline system uses a locally-running LLM (via Ollama) and a local vector store (ChromaDB) so every query and document stays on-device. This system demonstrates that production-quality RAG is achievable without any cloud dependency.
What is ChromaDB and when should you use it?
ChromaDB is an open-source, locally-runnable vector database optimized for embedding storage and semantic search. Use it when you need fast, private vector retrieval without a managed cloud vector service. It's ideal for RAG systems processing up to millions of documents where data privacy is required and managed services like Pinecone or Weaviate Cloud are not acceptable.
What does citation-backed retrieval mean?
Citation-backed retrieval means every answer includes a reference to the specific source passages used — chapter name, section, and page range from the original textbook. The user can verify the claim against the source. This is critical in medical and legal RAG systems where answer provenance must be auditable and fabricated information has real consequences.
What are the 6 MCP servers used for in this project?
Each of the 6 custom FastMCP servers exposes a specialized retrieval operation as a callable tool: chapter-level retrieval (for broad topic search), symptom-based search, drug information lookup, diagnostic criteria retrieval, treatment protocol search, and citation resolution. By breaking retrieval into specialized tools, the orchestrating agent can choose the most appropriate retrieval strategy for each query type.

Need a RAG system for your documents or data?

Sanskar Agrawal builds production RAG pipelines — offline or cloud-based — with ChromaDB, Pinecone, LangChain, and custom MCP retrieval tools. Based in Indore, India — available globally.