Handbook
201-04 — RAG and evidence
An offline run of answer_from_evidence using stub evidence and deterministic fake_chat JSON—mirrors integration patterns without retrieval infra.
Updated
What you will build
An offline run of answer_from_evidence using stub evidence and deterministic fake_chat JSON—mirrors integration patterns without retrieval infra.
Prerequisites
- 201-03
- Skim RAG and Task catalog RAG rows
Files you will touch
examples/rag/answer_from_evidence_fake.py
Step 1 — Run the maintained example
PYTHONPATH=src python3 examples/rag/answer_from_evidence_fake.py
Step 2 — Read the payload shape
Open the script: note question, evidence map (evidence id → snippet), and fake_chat returning JSON with answer, citations, confidence.
Step 3 — Break it intentionally
Temporarily return malformed JSON from fake_chat on a branch (do not commit) and observe Err—then revert.
Expected output
Successful run prints Ok with answer payload satisfying answer_from_evidence output schema.
Common failures
| Symptom | Fix |
|---|---|
Schema Err |
Align fake_chat keys with contract.json output |
| Empty citations when required | Populate citations list in fake JSON |
Verify
PYTHONPATH=src python3 examples/rag/answer_from_evidence_fake.py | grep -q Ok && echo OK
Optional live path
Live retrieval + gateways belong in consumer services—not required here. See live Granite tests.