Retrieval-augmented generation: cut documents into chunks, find the right ones for each question, and hand them to Claude.
1 / 4
Give Claude your documents, in chunks
Claude doesn’t know your documents, like manuals, policies or a wiki, so to answer from them it needs the relevant parts in its prompt. They’re too long to send whole, so split them into chunks: by section, or every few hundred words, overlapping a little. Each chunk should stand alone.
2 / 4
Search by meaning and by keyword
A user asks “What does error E-1042 mean?”, which only your internal docs explain. Find chunks to put in Claude’s context. Embeddings match meaning, as in “Words as points on a map”, but miss exact codes like E-1042; keyword search (BM25) catches those but misses rephrasings. Together, they work best.
3 / 4
Optional: contextual retrieval
Cut out, a chunk can lose its context: “Wait 30 seconds, then check the cable” sat under the E-1042 heading but never names it, so search misses it. Anthropic’s fix: have Claude add a line to each chunk saying where it belongs. In their tests, failed searches fell by half.
4 / 4
The whole flow
Search both indexes, put the best few chunks into the prompt, and ask Claude to answer only from them and to say which chunk each fact came from. That’s RAG (retrieval-augmented generation), the open-book exam from “Making a model yours”.