RAG prompt template builder
Retrieval-augmented generation only works if the prompt wrapping your retrieved chunks is right. The model needs the context clearly separated from the instructions, each chunk attributed to a source, an explicit instruction to answer only from that context, and permission to say the answer is not present. Get any of those wrong and you get confident hallucinations. This tool assembles a correct RAG prompt from your chunks and question in one step.
How it works
You paste each retrieved chunk, optionally prefixed with a source label on its first line. The tool numbers every chunk, carries its label into the prompt, and wraps the whole set in a delimited context section. It adds a user question and a set of grounding instructions: answer using only the provided context, cite the source for each claim in the citation style you choose, and respond that the information is not available when it genuinely is not.
You pick a citation style — numbered like [1], bracketed source labels, or named
inline — and the template adapts its instruction accordingly. Everything is
assembled in your browser; nothing is uploaded.
Tips and notes
Keep chunks focused and labelled: a few tightly relevant passages beat a dump of marginally related text, and a clear label (URL, title, doc ID) is what makes a citation verifiable. Always keep the “say when the answer is absent” instruction — it is the single biggest lever against hallucination in RAG. If answers cite the wrong chunk, your retrieval is surfacing irrelevant passages, not your prompt; fix retrieval first. For multi-fact answers, numbered citations make it easiest to audit which claim came from which source. Finally, test with a question your context does not answer, and confirm the model declines rather than inventing — that is the real test of a grounded RAG prompt.