AI Prompt to Make a RAG Assistant Say 'I Don't Know' When Context Is Missing
This is a RAG prompt for stopping a retrieval-augmented assistant from guessing when the retrieved documents don't actually contain the answer β built for developers and support teams running a ChatGPT, Claude, or Gemini-based Q&A bot over their own documents, where a confident but wrong answer is worse than no answer at all. It targets a specific failure mode: the model has a genuinely helpful default, so when the retrieved chunks are thin or off-topic, it tends to fill the gap with its own general knowledge instead of admitting the context doesn't cover the question.
The fix is to make the fallback behavior an explicit instruction rather than an assumption. The prompt tells the model to check the retrieved context against the question first, state plainly when the context is insufficient, and only answer using information it can point back to in the provided chunks β never from outside knowledge, even if the model "knows" the answer.
This only works as well as the retrieval step feeding it: if your pipeline is pulling irrelevant or fragmented chunks, no prompt wording can compensate, since the model can't answer from context that was never retrieved. Tightening what gets pulled in the first place with a tool like Cuelara's Context Extractor β which pulls only the relevant snippets from large PDFs or CSVs β reduces how often this insufficient-context case comes up at all.
Prompt template
ROLE: You are a question-answering assistant that must only use the provided context to answer questions. You must never use outside knowledge, even if you know the answer.
CONTEXT: [PASTE RETRIEVED DOCUMENT CHUNKS HERE]
QUESTION: [USER'S QUESTION]
INSTRUCTIONS:
- Check whether the context above contains enough information to fully answer the question
- If it does, answer using only that information, and quote or reference the specific part of the context you used
- If the context only partially answers the question, answer the part you can and explicitly state which part is not covered
- If the context does not contain relevant information at all, respond exactly with: "[INSUFFICIENT CONTEXT RESPONSE, e.g. I don't have enough information in the provided documents to answer this.]"
- Do not guess, infer beyond what the context states, or use any knowledge from outside the provided context
CONSTRAINTS:
- [ANY ADDITIONAL CONSTRAINT, e.g. keep answers under 150 words, cite chunk numbers if provided]
OUTPUT FORMAT: A direct answer to the question, or the insufficient-context response, followed by a short reference to which part of the context (if any) was used.
Example input
ROLE: You are a question-answering assistant that must only use the provided context to answer questions. You must never use outside knowledge, even if you know the answer.
CONTEXT: [Chunk 1] Our standard return policy allows returns within 30 days of purchase with a valid receipt. Items must be unused and in original packaging. [Chunk 2] Refunds are processed to the original payment method within 5-7 business days after we receive the returned item.
QUESTION: Can I return a product I bought 45 days ago if I lost the receipt?
INSTRUCTIONS:
- Check whether the context above contains enough information to fully answer the question
- If it does, answer using only that information, and quote or reference the specific part of the context you used
- If the context only partially answers the question, answer the part you can and explicitly state which part is not covered
- If the context does not contain relevant information at all, respond exactly with: "I don't have enough information in the provided documents to answer this."
- Do not guess, infer beyond what the context states, or use any knowledge from outside the provided context
OUTPUT FORMAT: A direct answer to the question, or the insufficient-context response, followed by a short reference to which part of the context (if any) was used.
Example output
Based on Chunk 1, returns are only accepted within 30 days of purchase with a valid receipt β a purchase from 45 days ago falls outside that window, so it would not qualify under the stated policy.
However, the context doesn't specify what happens if the receipt is lost within the 30-day window, so I can't tell you whether a lost receipt alone would be accepted for an otherwise-eligible return. That part is not covered by the provided documents.
Reference: Chunk 1 (30-day return window with valid receipt requirement).
When to use it
- Building a customer support or internal knowledge base bot that must never fabricate an answer when the docs don't cover the question
- Running compliance, legal, or medical Q&A over a fixed document set where an unsupported answer carries real risk
- Debugging a RAG pipeline to see whether hallucinations are coming from bad retrieval or from the generation step ignoring the context
- Building a chatbot that needs to escalate to a human whenever it can't answer from the available documents
Best practices
- Ask the model to quote or reference the specific part of the context it used, which makes it easy to spot when it's actually answering from outside knowledge instead
- Give the model an explicit phrase to use when context is insufficient (like "I don't have enough information in the provided documents to answer this") rather than leaving the fallback wording up to it
- Test the prompt deliberately with questions you know aren't covered by the retrieved documents, not just questions you expect it to answer correctly
- Before tightening the prompt further, run a few failure cases through Cuelara's Prompt Debugger to catch vague constraints or edge cases that let the model slip back into guessing
Common mistakes
- Only testing with questions the context clearly answers, so the insufficient-context behavior never gets exercised before launch
- Telling the model to "only use the context" without defining what counts as insufficient, leaving it to make that judgment call inconsistently
- Assuming a strict-context instruction fixes a retrieval problem, when the real issue is that the wrong chunks are being retrieved in the first place
- Not asking the model to distinguish between "partially answered" and "not answered at all," which are different situations a user needs to know about
FAQs
How do I stop a RAG chatbot from hallucinating answers?
Instruct the model explicitly to only use the retrieved context, give it an exact phrase to use when the context doesn't cover the question, and test it with questions you know aren't in the documents to confirm it actually falls back instead of guessing.
Why does my AI assistant answer questions that aren't in my documents?
Models default to being maximally helpful, so without an explicit instruction to refuse, they'll often fill gaps in the retrieved context with their own general knowledge. Adding a strict fallback rule and phrase fixes this at the prompting level.
Can ChatGPT or Claude tell when retrieved context doesn't answer a question?
Yes, when explicitly instructed to check the context against the question first and given clear rules for partial versus missing coverage β but this depends on the instruction being explicit, not something either model does by default.
Does this prompt fix hallucinations caused by bad retrieval?
No. This prompt only controls what the model does with the context it's given. If the retrieval step is pulling irrelevant chunks, the model can't answer correctly from them no matter how the prompt is worded β that requires improving the retrieval step itself.
What's the difference between a partial answer and an insufficient-context response in RAG?
A partial answer means some but not all of the question is covered by the retrieved context, and the model should state which part is missing. An insufficient-context response means none of the relevant information was retrieved at all, and the model should say so rather than attempting an answer.
Related Cuelara Tools
The quality of this prompt's output depends heavily on what actually gets retrieved before the model ever sees it. Two Cuelara tools are built for exactly that:
- Context Extractor β pulls only the relevant snippets from large PDFs, CSVs, and documents via RAG, so the context you hand to this prompt is tighter and less likely to trigger a false "insufficient context" response.
- Prompt Debugger β scans a prompt like this one for vague constraints and edge cases before you deploy it, catching the exact kind of ambiguity that lets a model slip back into guessing.