Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Concepts

Understanding how MedRAG organizes and retrieves medical knowledge.

Tenants

MedRAG is multi-tenant. Each tenant has:

  • Isolated knowledge bases and documents
  • Separate API keys
  • Individual billing plans and usage limits
  • Optional sub-tenants for delegated access within an organization

Knowledge Bases

A knowledge base is a collection of documents grouped by purpose. Examples:

  • Clinical guidelines (NICE, AHA, ESC)
  • Drug information databases
  • Patient education materials

Each knowledge base has a configured embedding dimension (e.g., 1024 for the self-hosted BGE-M3 model).

Documents

A document is a single piece of content ingested into a knowledge base. During ingestion:

  1. PII anonymization is applied (if enabled for the tenant)
  2. The content is split into chunks
  3. Each chunk is embedded and stored

Chunks

Chunks are the atomic units of retrieval. MedRAG splits documents by word count with overlap:

  • Default chunk size: 200 words
  • Overlap: 1/5 of chunk size (40 words) to preserve context across boundaries
  • Each chunk retains its position index and parent document reference

Platform Corpora

In addition to tenant-uploaded documents, MedRAG provides pre-loaded medical datasets (e.g., PubMed abstracts). Access to platform corpora requires accepting a Data Use Agreement (DUA). Platform corpora use corpus-specific chunking strategies optimized for their format.

Embeddings

Each chunk is converted into a vector embedding for semantic search. Embeddings are generated by self-hosted models running on MedRAG’s own EU infrastructure; your content is never sent to a third-party AI provider.

Queries

A query is a natural-language question or search term. MedRAG:

  1. Embeds the query using the same model as the knowledge base
  2. Performs approximate nearest neighbor (ANN) search using HNSW indexes
  3. Returns the top-k most relevant chunks with their source documents

Queries support optional filters:

  • Knowledge base IDs — restrict search to specific knowledge bases
  • Metadata filters — filter results by document metadata (tags, titles)
  • Sub-tenant scope — restrict to knowledge bases accessible by a sub-tenant

PII Anonymization

MedRAG can automatically detect and redact personally identifiable information during document ingestion. This is configurable per tenant and runs before chunking to ensure no PII leaks into stored chunks or embeddings.