Chapter 15 · when the whole document just fits
RAG existed because documents didn't fit. Now many do.
def ask(document, question):
r = client.responses.create(
model="gpt-5.4-nano",
instructions=f"Answer using this document.\n\n{document}",
input=[{"role": "user", "content": question}])
return r.output_text
What's new is the scale of what goes in instructions.
| Long context | RAG |
|---|---|
| Fits, can't miss | Scales past any window |
| Re-reads all each call | Fetches only what's needed |
| Single, stable doc | Large, changing corpus |
Not "better" — situational.
Q:, answer from all of itFits the window? Paste it and skip retrieval. Big or changing corpus? RAG. Mind the token bill and the lost middle. Next: prompt caching, cost, and latency — the money made explicit.