AI & LLM

RAG Answer with Citations JSON Example

A JSON example of a RAG (retrieval-augmented generation) answer with citations — the generated answer plus the source chunks and spans it references. Copy-ready for grounded AI answers.

{
  "question": "How long is the refund window?",
  "answer": "You can request a refund within 30 days of purchase.",
  "citations": [
    {
      "id": "doc_1190#chunk_2",
      "source": "help-center/refunds.md",
      "title": "Refund policy",
      "quote": "Refunds are available within 30 days of purchase.",
      "score": 0.91
    }
  ],
  "confidence": 0.88,
  "model": "gpt-4o",
  "createdAt": "2025-05-20T14:25:00Z"
}

Field Reference

answerrequiredstringThe generated answer, grounded in the cited sources
citationsrequiredarray<object>The retrieved chunks the answer is based on — shown to users for trust
citations[].quoteoptionalstringThe exact supporting span from the source, for verifiable grounding
citations[].sourcerequiredstringWhere the citation came from — links back to the document
confidenceoptionalnumberModel/system confidence in the grounded answer (0–1)

Variants

Inline citation markersAnswers can embed reference markers that map to the citations array.
Inline citation markers
{
  "answer": "Refunds are available within 30 days [1] and exclude used items [2].",
  "references": [
    {
      "marker": "[1]",
      "source": "help-center/refunds.md"
    },
    {
      "marker": "[2]",
      "source": "help-center/refunds.md#exclusions"
    }
  ]
}
No-answer (grounded refusal)When retrieval finds nothing relevant, a good RAG system abstains instead of hallucinating.
No-answer (grounded refusal)
{
  "question": "What is your phone support number?",
  "answer": "I couldn't find that in the available documents.",
  "citations": [],
  "confidence": 0
}

Common Use Cases

  • Returning grounded answers with verifiable sources in a RAG app
  • Rendering footnote-style citations in a chatbot UI
  • Detecting low-confidence answers to trigger a fallback or human handoff
ragcitationsgroundingsourcesllmretrieval

Validate or format this JSON

One click loads this exact example into the tool — no copy-paste needed. Format it, validate it, explore the tree, or generate TypeScript types instantly.

Frequently Asked Questions

Citations make answers verifiable and trustworthy: users (and you) can check the answer against the source. They also help debug retrieval — if a citation is wrong or irrelevant, the problem is in retrieval, not generation. Always carry source ids and exact quotes when you can.

It should abstain rather than hallucinate. When retrieval returns nothing relevant (or low scores), return a grounded refusal with empty citations and low confidence, and optionally route to search or a human. This 'no-answer' path is what separates reliable RAG from confident nonsense.

Related JSON Examples