Generation with Sources
Turn retrieved passages into an answer you can trust: prompt layout, a context budget, checked citations, a calibrated refusal and conflicting sources.
Retrieval finds the passages. This phase is about the last step: giving them to a model so that the answer is grounded (it says only what the sources say), cited (every claim points at a source the reader can open), and honest (when the sources do not contain the answer, it says so instead of guessing).
You will lay out a prompt with numbered, delimited sources, count tokens against a budget, order the passages, and verify citations in code instead of trusting the model. You will replace the crude score bar from Phase 0 with a threshold measured on real scores from a real embedding model, handle two sources that disagree, ask for a validated JSON answer, and check an answer against its sources by hand.
LLM Engineering Phase 8 gave the short version of this subject (numbered sources, a citation check, a refusal). This phase goes deeper and does not repeat it. Everything ends in the AskDocs build: a budgeted prompt, checked citations, a refusal before the model is even called, and conflicts shown instead of hidden.
Practise this phase
Hands-on exercises: write the code, run it, and press Check to have it tested automatically.