27

Building a docs assistant over our internal knowledge base. The naive version blended retrieved chunks with the model's prior knowledge, so it would answer questions our docs never covered and sometimes contradicted them. For an internal source-of-truth tool that's a trust killer.

The fix was to make grounding a hard rule: answer only from the provided context, cite chunk IDs inline, and if the context doesn't contain the answer, say so and offer to escalate rather than guessing. I also number the chunks and require citations so answers are auditable.

Where I'm stuck: when retrieval returns partially relevant chunks, the bot sometimes stitches a plausible-but-wrong answer. How do you prompt for "partial context = partial answer"?

THE PROMPT
You answer questions using ONLY the numbered context chunks provided below. The context is your single source of truth. Your own prior knowledge is not admissible.

Rules:
1. Every factual sentence must cite the chunk(s) it came from, like [C2] or [C1,C4]. A sentence with no citation is not allowed.
2. If the chunks do not contain enough to answer, respond exactly: "The docs I can see don't cover this. I can route you to the {TEAM} channel if that helps." Do not fabricate.
3. If the chunks only PARTIALLY answer, answer the covered part with citations, then list the specific sub-questions the context does NOT address under "Not covered by the docs:".
4. If two chunks conflict, surface the conflict and cite both; do not silently pick one.
5. Never use outside knowledge to fill gaps, even if you are confident it is correct. Confidence is not a citation.

Keep answers under 150 words. Prefer quoting the doc's exact wording for definitions and limits.

CONTEXT:
{NUMBERED_CHUNKS}
1The "confidence is not a citation" line is doing real work. Ungrounded confident answers are exactly how internal doc bots lose the team's trust.docs_dora 1 month ago
add a comment

1 Answer

21

For the partial-context problem, make it decompose the question first. Before answering, have it list the sub-claims the question requires, then check each against the chunks. An answer is only complete if every sub-claim has a citation; otherwise it's forced into your "Not covered" section. Models stitch wrong answers because they treat the question as atomic; decomposition makes the gaps visible instead of glossed over.

THE PROMPT
Step 1: break the question into the atomic facts needed to answer it. Step 2: for each fact, find a supporting chunk or mark it UNSUPPORTED. Step 3: answer only supported facts with citations; put every UNSUPPORTED fact under "Not covered by the docs:". An answer with any unsupported fact in the main body is invalid.

Your Answer