Claude Certification Program · Five exams · Guides updated December 7, 2026

Home › Study guides › CCDV-F › Domain 6 › Lesson 6.4

CCDV-F · Domain 6 · 15% of the exam · Lesson 6.4 · 19 min read Updated for the December 7, 2026 exam guide (v1.1)

Grounding and source citation: answers from your documents, or "not found"

Build a request that answers only from supplied documents, cites the passages, returns "not found" otherwise, and decide between full context and retrieval.

Written against skill 6.4 of the official CCDV-F exam guide (Version 1.1, effective December 7, 2026). An independent resource, not affiliated with Anthropic; the practice questions are written from scratch.

6.4.1 Why a fluent answer about your policy can still be wrong

Fernside Insurance sells home insurance, and its customers ask the same kind of question all day: "Is my garden fence covered after last night's storm?" Amaro, one of two back-end developers, built a chat assistant for the customer portal. His first version sent the question to Claude with a friendly system prompt ("You are Fernside's helpful insurance assistant") and nothing else. In testing the answers were clear and confident.

In the first week a customer quoted the assistant back to a claims handler: "Your chat said storm damage to fences is covered." Fernside's Home Plus wording says the opposite. Fences and gates are excluded from storm cover. The assistant had not lied on purpose. It had answered from what it knows about home insurance in general, and many policies do cover fences. Ottoline, who runs the claims team, asked a fair question: how was anyone supposed to know where that answer came from?

That is the gap. A plain model call answers from its training, which knows a lot about insurance and nothing about Fernside's wording. Nothing in the reply marks which sentences come from the policy, and where the policy is silent the model fills in something plausible. The fix is grounding: you supply the documents that hold the answer, you require the answer to come only from them, you make it cite the passages it used, and you give it a defined way to say "not found".

6.4.2 What a grounded request contains

Here is the belief to drop first: that a stronger instruction such as "be accurate and never make things up" fixes the fence answer. It cannot. The model cannot be accurate about a document it has never seen. Grounding starts with the request, and a grounded request has four parts, in this order.

The four parts of a grounded request

DOCUMENTSthe policy wording, with title and source
RULESanswer only from them; cite; else NOT_FOUND
QUESTIONthe customer's words, at the end
ANSWERcited passages, or NOT_FOUND
Documents go first and the question last; the answer is either backed by citations or is the agreed "not found" signal.
  1. DOCUMENTS. The text that holds the answer, each with a title and a source so it can be named in a citation. Anthropic's prompting guidance says to put long documents near the top of the prompt, above the query and instructions; in its tests, queries at the end improved response quality by up to 30 percent, especially with several documents.
  2. RULES. Answer only from the supplied documents, not from general knowledge. Cite the passage behind each claim. Return a fixed signal when the documents do not contain the answer.
  3. QUESTION. The user's words, after everything else.
  4. ANSWER. Either a cited answer or the signal, nothing in between.

Amaro's new system prompt carries the rules. Look at three lines: the restriction to the wording, the exact NOT_FOUND reply, and the rule for a question the wording only half answers.

You answer customers' questions about their Fernside home insurance policy.
Use ONLY the policy wording supplied in the documents. Do not use general knowledge about insurance, and do not guess what a typical policy says.
If the wording does not answer the question, reply with exactly: NOT_FOUND
If the wording answers only part of the question, answer that part and say which part the wording does not cover.
Never say that a claim will be paid. Say what the wording says.

Anthropic's guide to reducing hallucinations names these same moves: permission to say it does not know, a restriction to the provided documents, and quotes or citations behind each claim. For documents over 20,000 tokens it adds one more: have Claude pull out word-for-word quotes first and answer from those. Fernside's 30,000-token wording qualifies, and the API can do the quoting for you.

6.4.3 Citations: let the API point at the passage

Amaro's first attempt at citing was a prompt: "After each claim, quote the sentence from the policy that supports it." Then Ottoline found a quote that appeared nowhere in the wording; the model had stitched two clauses together. A citation you cannot trust is worse than none, because it looks like proof.

The citations feature of the Messages API closes that gap. You send each document as a document content block and set citations.enabled to true. The API splits the document into chunks (sentences, for plain text and PDFs), and the response comes back as several text blocks, each claim carrying a citations list that points at the exact passage. Because the API extracts cited_text itself, the docs state that citations are guaranteed to contain valid pointers to the provided documents. The docs also report that the feature cites the most relevant passages significantly more often than prompt-based quoting, and cited_text does not count toward output tokens.

Look at the three commented lines: the document comes before the question, citations are switched on per document, and the wording is cached because it is the same for every question.

import anthropic

client = anthropic.Anthropic()

response = client.messages.create(
    model="claude-sonnet-5-5",
    max_tokens=1024,
    system=GROUNDING_RULES,                      # the system prompt above
    messages=[{"role": "user", "content": [
        {"type": "document",                       # DOCUMENT FIRST
         "source": {"type": "text", "media_type": "text/plain", "data": home_plus_wording},
         "title": "Home Plus policy wording, 2026 edition",
         "citations": {"enabled": True},          # CITE: exact passages come back
         "cache_control": {"type": "ephemeral"}}, # same wording on every question
        {"type": "text", "text": customer_question},   # QUESTION LAST
    ]}],
)

What comes back depends on the document type, and so does what you can show the customer.

Document type How the API chunks it Where a citation points
Plain text Into sentences char_location: start and end character, 0-indexed
PDF (text, not scans) Extracts the text, into sentences page_location: start and end page, 1-indexed
Custom content Not further: each block you supply is one chunk content_block_location: start and end block, 0-indexed

Memorise that a citation carries cited_text, a document_index and a location; the three location formats only need recognising. Custom content lets you set the unit of citation, one clause per block.

Three rules from the docs catch builders out. A request cannot mix documents that have citations enabled with documents that do not. Claude cites text, not images, so a scanned PDF with no extractable text cannot be cited. And citations cannot be combined with structured outputs: a request that enables citations and also sends output_config.format returns a 400 error. If you need fields and citations together, the docs suggest asking for one field: value line per field and parsing the lines in your code. With streaming, citations arrive as citations_delta events alongside the text.

6.4.4 "Not found" is an answer your code must handle

Here is the question that trips people up, and the exam likes it: what should the assistant do when the wording does not mention the thing the customer asked about? Fernside's Home Plus wording says nothing about solar panels. Without a defined path the model faces two bad options, guessing or refusing vaguely, and a vague refusal ("You may wish to check your documents") is nearly as unhelpful as a guess.

The "not found" path is a contract between the prompt and your code. The prompt defines the exact reply (NOT_FOUND). Your code checks for it and does something useful: it tells the customer the wording does not cover the question and offers a person. A good reference librarian works the same way: when the library holds nothing on your topic, she says so and points you to someone who can help; she does not invent a book. The signal has to be exact because code, not a person, reads it.

Grounding also needs a second check, because a confident tone is not evidence. Look at what Ottoline's team learned to trust.

Which answers count as grounded?

Sounds confident and specificgeneral knowledge sounds just as sure
Mentions "your policy"words cost nothing
Contains a quote the model typedit may be stitched or paraphrased
Long and detaileddetail is not a source
Carries API citations into the wordingcited_text from the document you sent
Only a citation the API extracted from the supplied wording shows where a claim came from; tone, length and quoted-looking text do not.

So the code treats two cases the same way: an answer that contains NOT_FOUND, and an answer that came back with no citations at all. Look at the last four lines. The check looks for the signal anywhere in the reply, not only at its start, in case the model adds a word around it. The second case matters because the API guarantees valid pointers, not a citation behind every claim.

answer_parts, sources = [], []
for block in response.content:
    if block.type != "text":
        continue
    answer_parts.append(block.text)
    for c in block.citations or []:
        sources.append((c.document_title, c.cited_text))

answer = "".join(answer_parts).strip()
if "NOT_FOUND" in answer or not sources:         # NOT FOUND, or ungrounded
    offer_handoff(customer_question)                # a person answers instead
else:
    show_answer(answer, sources)                    # every answer shows its passages

Two more habits finish the job. For a long reply, ask Claude to find a supporting passage for each claim and remove any claim it cannot support, the retract step from the hallucination guide. And test the path on purpose: Fernside's test set includes questions the wording cannot answer (solar panels, earthquakes, a neighbour's tree), and each must come back NOT_FOUND. A grounded assistant that never says "not found" is not grounded; it is lucky.

6.4.5 Full document set or retrieved passages?

Fernside's second project raised the next question. Contact-centre staff want the same grounded answers over the whole underwriting and claims handbook: about 2,400 documents, roughly 4 million tokens, with new guidance bulletins every working day. Amaro's first instinct was to send everything. That cannot work, and the choice it forces is one the exam guide names: supply the full document set in context, or retrieve only the relevant passages.

Full context means every request carries the whole document set. Retrieval, often called RAG (retrieval-augmented generation), means your code first searches an index of chunked documents for the passages most relevant to the question and sends only those. Three factors decide.

Two ways to supply the documents

Full set in context

Every request carries all of itthe whole wording
Cache the stable prefixreads billed at a fraction

Fits: small, stable corpus

Retrieve relevant passages

Search an index firsttop passages only
Update one document at a timeindex stays fresh

Fits: large or fast-changing corpus

Full context gives the model everything but bills for everything; retrieval sends little but can only answer from what the search found.

Size comes first. The document set plus the conversation must fit the context window, which is 1 million tokens on the current Claude models. The handbook's 4 million tokens do not fit, so size alone decides it. Anthropic's article on contextual retrieval sets a lower line: a knowledge base under about 200,000 tokens (some 500 pages) can go in the prompt with no need for retrieval. If it fits comfortably, start there.

Cost comes next, because every request pays for every token it carries. The Home Plus wording costs about $0.06 per question on Claude Sonnet 5.5 at $2 per million input tokens, or $180 a day at 3,000 questions. Prompt caching changes that: a cache read on Sonnet 5.5 is billed at 0.05 times the base input price, about $0.003 per question, plus the occasional cache write at 1.25 times. Model choice matters too: on Claude Haiku 5.5, a prompt over 100,000 tokens is billed at higher rates.

Freshness is the third factor. A cache hit needs an identical prefix, so a document set that changes every hour keeps paying for cache writes, while a retrieval index can replace one document and leave the rest untouched.

Factor Favours the full set in context Favours retrieval
Size Fits comfortably in the window Exceeds it, or crowds out the conversation
Cost Stable prefix, many questions, cached Huge per-request input even when cached
Freshness Changes rarely (a yearly policy edition) Changes daily or per document
Question shape Needs the whole document ("what is excluded?") Answer sits in one or two passages

The last row is the cost of retrieval. The model can only cite what the search returned, so when the right passage is not retrieved, a well-grounded model correctly answers NOT_FOUND for something the handbook does contain. That is a retrieval failure, not a model failure, and the fix belongs in the search: better chunking, hybrid keyword and embedding search, reranking. In Anthropic's contextual retrieval work, that combination cut retrieval failures by up to 67%. To cite retrieved passages, use search result blocks: your code passes each passage as a search_result with a source, a title and citations enabled, in the user message or from a custom tool. Citations then come back as search_result_location, naming the source you supplied. As with documents, all search results in one request must share the same citation setting.

6.4.6 The exam traps

  • ✗ Adding "be accurate, do not make things up" to a prompt that contains no source documents. ✓ Supply the documents, restrict the answer to them and require citations, because the model cannot ground an answer in text it never received.
  • ✗ Letting the model fill gaps with general knowledge, or refuse in vague words. ✓ Define an exact NOT_FOUND reply that your code detects and routes, and test it with questions the documents cannot answer.
  • ✗ Trusting quotes the model was asked to type, or a confident answer with no citations. ✓ Use the citations feature, whose pointers are extracted by the API, and treat an uncited answer as ungrounded.
  • ✗ Enabling citations and structured outputs on the same request, or citations on only some of the documents. ✓ Citations with output_config.format return a 400; parse field: value lines instead, and enable citations on every document in the request.
  • ✗ Building a retrieval pipeline for a small, stable document, or sending a huge, changing corpus in every request. ✓ Decide by size, cost and freshness: cache the small stable set, retrieve from the large or changing one.
  • ✗ Removing the "not found" rule because retrieval-based answers say "not found" too often. ✓ Check whether the right passage was retrieved; if not, fix the search, because the model was right not to answer.

6.4.7 Put it together: ground an answer, then watch it drift

The exercise builds a small version of Fernside's policy assistant and breaks it twice.

Grounding sits beside the other skills of this domain. Structured output and defensive parsing (6.3) protects code that needs fields, which is why the field-by-line pattern matters when citations rule out structured outputs. Context management (6.1) keeps a long session from burying the documents you supplied. And retrieved documents are untrusted input, which prompt injection defence (7.1) treats on its own terms.

Key takeaways

  • ✓ A plain model call answers from training knowledge; grounding supplies the documents, restricts the answer to them, requires citations and defines "not found".
  • ✓ Put long documents first with titles and the question last, and give Claude explicit permission and an exact reply for "the documents do not say".
  • ✓ The citations feature returns cited_text and a location the API extracted from your documents, so its pointers are valid where prompt-written quotes may not be.
  • ✓ Citations need every document in the request enabled, cite text but not images, and return a 400 when combined with structured outputs.
  • ✓ Your code routes a NOT_FOUND answer, and an answer with no citations, to a person or a clear message, and tests unanswerable questions on purpose.
  • ✓ Supply the full set when it fits, changes rarely and can be cached; retrieve passages when size, cost or freshness rule that out, and fix the search when the right passage is missing.

Check your understanding

4 questions written for this lesson. Every answer option is explained, including the ones you did not pick. Nothing is stored.

CCDV-F practice questions are being rewritten

The 159 CCDV-F practice questions here were written for the previous exam guide and are tagged to its domains. New questions for the December 7, 2026 guide (v1.1) are being written. Until they are ready, the practice for the new guide is the questions at the end of every lesson, with every answer option explained. The old bank stays open for general practice.

Back to Domain 6 → The previous-guide bank →

Sources