Prompt LibraryEngineering

RAG Citation & Source Formatter Prompt

Format grounded answers with inline citations.

The prompt

Rewrite the answer below with inline citations to the source chunks.
Format: [1], [2] after the claim, with a Sources list at the end mapping each number to the chunk title and URL.
If a claim has no supporting chunk, remove it and note "[unsourced, removed]".
Do not cite a chunk for a claim it doesn't actually support.

Answer:
{{answer}}
Source chunks (with IDs and URLs):
{{chunks}}

Replace the {{fields}} with your own context and tighten the rules to match your domain.

Share this prompt