Best Practices for Building LLM Apps

Chapter 7 · Practice 3 of 4

Ground factual answers in sources and let the model say it does not know

From Failures, fallbacks and misinformation

Why it matters

Misinformation is on the OWASP list because models state wrong facts confidently. For factual features, ground every answer in sources you control.

In the prompt, give the model the relevant sources and ask it to:

  1. answer only from them;
  2. cite which source supports each claim;
  3. say so when the sources do not contain the answer.

In code, check the citations: every cited id should exist in what you retrieved.

In the UI, show sources next to the answer and avoid presenting generated text as verified fact.