AI MOOC
✦ Grow togetherInvite 3 friends, earn 1 month of membership · Up to 12 monthsInvite friends →

Library / My reading notes

Assemble evidence, cite claims and state gaps

Build reviewable context and output rules without mistaking citations for correctness.

Back to the RAG course plan: Build a searchable, cited RAG knowledge base

Chapter 5 / 8 · Read and take notes

Build reviewable context and output rules without mistaking citations for correctness.

Understand the method

Inspect prompt(): system instructions define boundaries; the user message contains a JSON-encoded question and evidence. Each source has an ID and version with its original wording. Candidates remain evidence to inspect, not guaranteed answers.

Output uses answer, citations and abstain. IDs enable programmatic membership checks; inline versioned markers aid human review; abstain indicates incomplete support. Schema conformance alone does not establish correct reasoning.

Compare assigning the staff cap to interns with explaining that P2 requires approval but gives no cap. A citation can accompany a false claim. Abstention can state supported facts and the missing information together.

Source text may contain hostile instructions. Treat it as data, not higher-priority instructions. The lab performs no tools or external actions, but a prompt alone is not a complete injection defense. Production needs layered controls and adversarial testing.

validate_answer() checks non-empty text, types, citation membership and citations for non-abstained answers. It cannot verify the meaning of a claim or its audience. Record structural validity and factual review separately.

Write references for Q1, Q2 and Q4 before model use. The no-invoice question does not justify inventing an exception or replacement process. Preserve what the source actually states.

  1. 1Identify
  2. 2Constrain
  3. 3Validate
  4. 4Review

Included material

Illustrative human reference format, not an observed model response:
{"answer":"The cap is unspecified; prior approval is required [P2 v1].", "citations":["P2"], "abstain":true}

Work through the steps

  1. Locate prompt() and validate_answer() and describe their separate roles.
  2. Write all three fields for Q1, Q2 and Q4 by hand.
  3. Construct an unknown P99 citation and an audience-mismatched answer; identify which is automatically detectable.

Worked example

Defect A: P99 is rejected by membership validation.
Defect B: an intern claim citing P1 may pass structure if P1 was retrieved, but is factually wrong.
Repair applicability filtering and review the claim.

Your exercise

Add a hostile instruction to your own corpus copy. Explain why it is data and define one review check. Use no private information.

Check before delivery

  • State the exact evidence gap without inventing rules.
  • Separate schema validation from factual review.
Finish the exercise, then view the reference

Unknown IDs can be blocked automatically; citation meaning needs source review. Record observed attack responses rather than claiming prompt wording guarantees safety.

An original course with teaching exercises. Reading records, practice outcomes and independent certification are distinct.

References and further reading

The lessons are original. The following sources are provided under their respective permissions.

Article / guide

Prompt Engineering Guide

DAIR.AI · en/zh

MIT

License checked. This entry links to the original; the book text is not mirrored.

License checked: 2026-10-16 · Pinned 57673726
Article / guide

RAG and Vector Databases

Microsoft · en/zh

MIT

License checked. This entry links to the original; the book text is not mirrored.

License checked: 2026-10-16 · Pinned d45da912
Whitepaper / report

NIST AI 600-1: Generative AI Profile

NIST / Autio et al. · en

NIST Technical Series reprint policy

Original PDF provided under the institution’s reprint policy.

License checked: 2026-10-16
Article / guide

Ollama Chat API

Ollama · en

Official documentation link; no full-text reproduction

Original link only; full text is not mirrored.

License checked: 2026-10-20