Skip to content
Gjalt van der Meer, Home

MedRAG

Answering questions about medicines from the official product information, with a source for every answer. The design is in place; the code has not run yet.

Role
Plan and setup of the pipeline
Started
Sep 2026
Status
In progress
For
school (Master Human-Centred AI, Hogeschool Utrecht)
Stack
Python, multilingual-e5, BM25, Chroma, Claude API

Background

A school project on retrieval-augmented generation (RAG): a language model that answers from retrieved documents. The goal is to answer questions about medicines from the official product information of the Dutch Medicines Evaluation Board (CBG), with the source next to every answer, so the reader can verify each answer. The system does not give personal medical advice.

My role

I wrote the five-phase plan and set up the pipeline.

Approach and key decisions

  • Official sources only. Five PDFs from the CBG with product information and assessment reports, in Dutch and English. In addition, scientific papers from Europe PMC. An AI step screens those papers against fixed inclusion and exclusion criteria and records the result.
  • Hybrid search. Embeddings (multilingual-e5) and BM25 search side by side. Reciprocal rank fusion merges the results, then a reranker orders the passages. Reason: questions mix Dutch and English, and medicine names have to be matched exactly.
  • Answers with citations. The language model answers only from the retrieved passages and cites them. A guardrail layer refuses personal medical questions, blocks answers without a source and adds a disclaimer.
  • A thin pipeline of my own. No LangChain or LlamaIndex, but one small module per step. I have to be able to explain and defend every step.
  • Measure before judging. The evaluation is set up to measure retrieval with recall@k and hit@k, and answer quality with a language model as judge.

Technology

Python, with Chroma for the embeddings and a separate BM25 index. The embeddings and the reranker run locally. The Claude API writes the answers. The code has three entry points: a command line, a FastAPI endpoint and a Streamlit interface. Tests are written for chunking, merging the search results, the tokenizer and the guardrails.

Current state

On 19 September 2026 the plan and the code structure were in place. The code is set up for all phases but has not run yet. The test set holds only one placeholder question. The project has been paused since 28 October 2026.

Next steps

First a test set of 30 to 50 questions with their correct answers, then a first full run. Only then can I say whether the chosen approach works.

Result

  • No measured outcome yet: the project is still running.

  • Not measured

    How good the answers are. That needs a test set of 30 to 50 questions, which does not exist yet.

Code

Project-RAG
On requestYou can ask for read access to this code.
Ask for access