DEV Community

Cover image for When The Same Question Needs A Different Answer Depending On Where The Caller Is
FARHAN HABIB FARAZ
FARHAN HABIB FARAZ

Posted on

When The Same Question Needs A Different Answer Depending On Where The Caller Is

A knowledge base built for a company operating across multiple regions almost always contains information that is correct in one location and wrong in another, and a RAG system that retrieves without any location awareness will happily surface the wrong version with complete confidence, because nothing in the retrieval process itself knows to prefer one regional document over another.

This shows up constantly in deployments spanning more than one branch, market, or regulatory zone. A policy document exists for headquarters, a slightly different version exists for a regional office, and both live in the same knowledge base because both are legitimately true, just true for different callers. A retrieval system built without explicit location scoping treats both documents as equally relevant candidates for any query touching that topic, and depending on which chunk happens to rank higher for that specific phrasing, a caller in one region can easily receive an answer written for an entirely different one.

The failure is particularly hard to catch during testing, because testing tends to happen from one location, using one set of assumptions about which document should be the right match. Everything looks correct until the system goes live across multiple regions simultaneously, and only then does the inconsistency surface, usually because someone in a regional office notices the bot quoting a policy that has never applied to them.

The fix starts with treating location not as a piece of information to mention if asked, but as a filtering parameter that shapes retrieval itself, before generation ever happens. This means the system prompt and retrieval logic together need an explicit instruction that any location dependent query must first resolve which regional document set actually applies, and only then search within that scoped set, rather than searching the entire knowledge base and hoping the right regional match happens to surface first through relevance scoring alone.

Getting the location signal itself reliably is its own separate problem, and the more elegant solutions tend to avoid interrupting the conversation to ask directly. A caller's phone number prefix, an account's registered address already on file, a web session's browser locale, any of these can serve as a location signal that gets resolved silently before the first response is generated, rather than adding a clunky which region are you calling from question into the middle of an otherwise natural interaction. The instruction set has to specify a fallback order for these signals too, because they will not always agree, a caller might be physically in one region while their account is registered in another, and the system needs an explicit rule for which signal takes priority when they conflict, rather than picking arbitrarily.

The harder part of this design is deciding what happens when the location signal is genuinely ambiguous or unavailable, because defaulting silently to one region's rules produces exactly the same wrong-answer failure the whole system was built to prevent. A well designed instruction set treats an unresolved location as its own case requiring an explicit, brief clarifying question, rather than assuming a default and answering confidently from the wrong document set anyway. That distinction, refusing to guess when the signal genuinely is not there versus resolving it silently when it reliably is, ends up being the actual core of the design, more than the mechanics of the retrieval filtering itself.

Custom instructions built this way tend to hold up noticeably better across multi region deployments than instructions that treat location as an afterthought layered on top of a single unified knowledge base, because the scoping happens structurally before generation rather than being left to the model's judgment about which retrieved chunk to trust more.

Written by Mohammad Farhan Habib Faraz
Senior Prompt Engineer and Prompt Team Lead at PowerinAI
www.powerinai.com

Top comments (0)