module-34/rag-weaver.mdPRODUCTION MODULE

The RAG Weaver

AI answers built only from your data — with the receipts attached.

The chatbot answered confidently, cited nothing, and was wrong about your own product.
Retrieval-augmented context with forced citation — answers built only from retrieved chunks, each response traceable to its source.

The incident

The support bot was asked about a refund policy. It answered fluently, confidently, and wrongly — describing a policy the company never had. The model wasn't broken. It was doing exactly what ungrounded models do: completing plausible text. Plausible isn't true.

Why the obvious approach fails

An LLM without retrieval answers from training data — which doesn't include your business, your policies, or anything after its cutoff. Prompting it to 'only say true things' is asking a text-completion engine for a property it doesn't have. And the brute-force fix — stuffing your whole knowledge base into the prompt — is slow, expensive, and beyond context limits. Grounding is an architecture: retrieve the relevant slice, constrain generation to it, and make every answer show its sources so wrongness is at least visible and traceable.

The standard

  • Answerable scope is defined by the retrieval corpus; questions outside it get an honest "not in my sources," not improvisation.
  • Retrieval brings the top-K relevant chunks (via the Vector Pulse); the system prompt hard-constrains generation to the provided context.
  • Every response carries source citations (chunk IDs) surfaced in the UI — users can check the receipt.
  • Retrieval quality is measured independently of generation quality; eval suites run on both, per release.
  • Low-confidence retrievals degrade to escalation paths (human handoff), never to confident guessing.

How Cortex validates it

At plan time

AI-feature blueprints declare the corpus, retrieval strategy, citation surface, and out-of-scope behavior before build.

At validation

assert: responses.citations != emptyassert: out_of_corpus_questions → declined_or_escalatedassert: eval_suite(groundedness) >= release_bar

Assertion syntax is illustrative.

At review

The approver sees the eval run: grounded-answer rate, citation coverage, and the out-of-scope question set behaving honestly.

Composes with

See where your codebase stands against this standard.