How to test a RAG assistant when the answer is missing
Ask an internal assistant "How much vacation can I carry over?" for a country whose policy you have in the knowledge base. Then ask it for a country whose policy is missing. I'd spend more time testing that second case.
Ask an internal assistant "How much vacation can I carry over?" for a country whose policy you have in the knowledge base. Then ask it for a country whose policy is missing. I'd spend more time testing that second case. A reply can sound like it came from HR even when it has no policy to cite.
I'd start with about twenty questions. For each, record the supporting passage, who can see it, and what the assistant should say when the passage is unavailable. Include two policy versions that disagree and a question that assumes something the policy doesn't say.
Keep the evidence from each run
Log the document IDs and their search ranks. Record which document versions went to the model, then keep the answer and its citations. If retrieval missed the passage, check the search filters and how you split the text. If the passage reached the model and the answer contradicts it, check the prompt and look at how much unrelated text went in with it.
An archived vacation policy can have the same heading as the current one. I'd test that the default search finds the current policy and that a request for an older version can still find it. Put the effective date on each chunk and in the citation so readers can tell which policy the answer used.
Remove a passage and run the same question again
Take a question the assistant can answer and remove its supporting passage from the search index. The expected reply should say that the documents don't establish a carryover limit and point the reader to the policy owner. If the model supplies a number from memory, fail the test even if the number happens to be right.
Rerun that case after changing retrieval or the prompt. A test set where every question has a current source won't catch the assistant inventing an answer when that source disappears.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.