RAG retrieval sources are passed through to the model context
Why it matters
A RAG pipeline that retrieves documents but fails to inject them into the model context — or injects them as unstructured blob text — is just an expensive vector search that the LLM cannot use. The model falls back to parametric knowledge, hallucinates confidently on domain-specific questions, and cites sources it never saw. This breaks the inference-contract taxon: you promised grounded answers, you delivered confabulation. Users trust the retrieved citations exactly when they are least reliable.
Severity rationale
Medium because RAG hallucinations bypass the safety layer users believe they are paying for.
Remediation
Wrap each retrieved chunk in labeled delimiters before injection, and instruct the model to answer only from the provided context and acknowledge insufficient context explicitly. Apply this at the retrieval boundary in lib/rag.ts.
const contextBlock = docs.map((d, i) => `<source id="${i+1}" title="${d.metadata.title}">\n${d.pageContent}\n</source>`).join('\n')
const userMessage = `Answer from the sources below. If insufficient, say so.\n\n${contextBlock}\n\nQuestion: ${q}`
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the AI Response Quality Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- owasp-llm:2025 · LLM09 — Misinformation
Taxons
History
- 2026-04-18·v1.0.0·Initial import from ai-response-quality·automated