09
Building the answer
Turn found chunks into a grounded, cited answer, or an honest I don't know.

Concept 9.1
Context selection, packing and citations
Turning ranked chunks into a prompt: how many, in what order, labelled how, and how to make every claim point at a numbered source. With measured context sizes and a citation check.

Concept 9.2
Grounding prompts and abstention
Retrieval always returns something, even for questions the documents cannot answer. A grounding prompt tells the model to answer only from the sources and to say when it cannot, and a test set checks that it does.

Concept 9.3
Lost in the middle and context management
Models use the start and end of a long context better than the middle. Where our answers land in the context, and how ordering, short contexts and trimmed history keep the answer where the model looks.

Concept 9.4
Conflicts, staleness and freshness rules
When two sources disagree, or an old version sits next to the current one, the model needs rules. On our corpus 5 of 8 version questions had an outdated version in the top 3.

Concept 9.5
Hallucination checks and answer verification
Check an answer after it is written: are its numbers, codes and dates in the cited sources? A simple number check passed 38 of 39 real answers on our corpus and caught 28 of 39 answers with one number changed.

Concept 9.6
Conversational RAG, answer UX and RAG APIs
Follow-up questions, showing sources, collecting feedback and returning structured answers. We searched 7 follow-ups three ways: as typed, glued to the previous question, and rewritten.
Chapter 9 recap