All field notes

AI field guide2 min read

Build a RAG assistant that can show its work

Connect generation to retrieved evidence with a practical pipeline for ingestion, permissions, citations, and unanswered questions.

Bookshelves and reading space inside a cozy bookstore.
Photo by Clay Banks on Unsplash · LicenseEditorial photograph, not a technical diagram.
01

Retrieval supplies evidence at answer time

Retrieval-augmented generation combines generation with information obtained from an external collection. The original RAG research explored combining model parameters with retrieved, non-parametric memory. In a product, a common adaptation is to retrieve relevant source passages and provide them as context for an answer.

This makes it possible to use information outside a model's training data, but retrieval does not guarantee correctness. The source can be stale, the wrong passage can be selected, or the answer can go beyond the evidence. Each stage needs its own checks.

Technical foundation: Lewis et al.: Retrieval-Augmented Generation

02

Start with a small, owned collection

Choose a corpus with a clear owner and update process. For a documentation assistant, start with the current installation guides and API references rather than crawling every historical page. Preserve headings, code boundaries, release versions, and canonical source links during ingestion.

Define what happens when two sources disagree. A current release reference may take precedence over an old tutorial, but that rule should be explicit. Keep an ingestion report showing rejected files, missing metadata, and the latest successful refresh. Silent ingestion failures otherwise become confusing answer failures.

03

Retrieve within the user's authority

A search query should operate inside the current user's allowed collection. Do not retrieve private material and hope the model will avoid mentioning it. Tenant, role, document, and revision restrictions belong in the retrieval layer and must also be enforced when opening the source.

The model receives selected passages with stable identifiers. Ask it to associate factual claims with those identifiers. Resolve citation links through the application rather than accepting arbitrary generated URLs. A citation is useful only if the linked passage actually supports the nearby claim.

04

Build an honest no-answer path

Suppose a user asks whether a component supports a feature not mentioned in the docs. A useful assistant can say the available documentation does not establish support, link the closest relevant page, and suggest a next step. It should not turn an absence of evidence into a confident yes or no.

Evaluate retrieval separately from generation. First ask whether the right passage was available in the retrieved set. Then ask whether the answer used it faithfully. This separation prevents wasting time rewriting prompts when the real issue is a missing source or a broken index.

05

Evidence before eloquence

  • Own the corpus and document its refresh process.
  • Preserve versions and resolve conflicting authority.
  • Filter access before passing evidence to the model.
  • Verify citations against actual supporting passages.
  • Test missing, stale, contradictory, and unauthorized sources.