Skip to content

RAG — inspect retrieved text

In a retrieval pipeline, inspect each chunk after retrieval and before prompt assembly. Detection, not prevention — your app decides how to review or omit a chunk.

Detection, not prevention. A successful run with no findings means the check did not flag the submitted text — not that the chunk is safe to use.

Where inspection sits

Wire the check into the retrieval path at one place:

  1. Retrieve candidate chunks from your index or uploads.
  2. Inspect each chunk’s text after retrieval and before prompt assembly (API field source=retrieved_document is a text-type label, not source-aware policy).
  3. Assemble the prompt only from chunks you keep after review.
  4. Your app owns timeouts, omissions, and any human review — ANANZI returns findings, not enforcement.

What that does not guarantee

Integration sketch

Scaffold preview — not a live API call. Start in monitor-only mode.

# RAG path (scaffold)
1. retrieve chunks
2. POST inspect  source=retrieved_document  checks=[prompt_injection]
3. on review → omit or escalate the chunk
4. on no_findings → proceed (check did not flag — not a safety guarantee)
5. assemble prompt → call your model

Article: detector timeouts and fail-closed handling · prompt_injection product page · secrets product page · Local docs live in apps/docs (Starlight). Deploy is tracked separately.