Exercise ex-citation-check — is every cited claim actually in the chunk it cites?

In Java, a citation is a reference you trust because the compiler already checked the types line up. An LLM's [2] is not that — it is a token the model generated because a citation-shaped answer scored well, and nothing forces the sentence in front of it to be true of chunk 2. Evaluating RAG scored faithfulness for a whole answer at once; this exercise is the per-claim version that actually tells you which sentence to fix. No judge model here — that comes next, in ex-ragas-mock — because a deterministic check is the thing you calibrate a judge model against, and a red row you can read beats a score you have to trust.

~75 minruns locally · uv + pytest 7 checksex-citation-check

What you're building

The tests are ordinary pytest and ship in the public folder with the starter — read them first; the names below are the check list. Solutions are not published. This runs locally rather than in the browser because it is the production shape: f1-build reuses this exact module to check citations on 50 real answers, and a pytest suite with its own pyproject.toml is what that module actually ships as.

Get the repo (once)

Needs git. uv installs the right Python itself, so nothing else is required.

# once, anywhere on your machine
git clone https://github.com/theDocWho/ai-ml-roadmap.git
cd ai-ml-roadmap

No git? Download the ZIP, unzip it, and cd into the unzipped folder instead.

Run it

From the repo root:

# one-time: uv (https://docs.astral.sh/uv/) manages the venv and pins Python ≥ 3.12
cd exercises/ex-citation-check && uv sync && uv run pytest -q

# the same bar the reference solution clears
uv run ruff check . && uv run mypy src

Done when uv run pytest -q prints 7 passed. Rerun after every edit; pytest's -q output is the only readout this exercise has.

The checks

Files

This is self-attestation — the site cannot see your terminal, so the box and the button are you telling The Path the suite went green on your machine.

If you get stuck