Skip to main content

Citation Verifier

The citation-verifier policy runs in the output phase. It gets supported citation patterns. It can examine RAG context overlap. It also records verification details. It blocks only unverified output when output_action.unverified_action is block.

Use stream: false for this control. The active SSE path does not run this verifier against buffered output.

Phase and verdicts

  • Phase: output
  • Possible verdicts: allow, block

Configuration

pack:
name: citation-verifier-example
version: 1.0.0
enabled: true
policies:
chain:
- citation-verifier
policy:
citation-verifier:
require_sources: true
require_source_match: true
min_confidence: 0.8
min_groundedness: 0.8
extract_patterns:
- case_law
- academic
- url
- quote
- statistic
rag_context:
verify_against_context: true
min_context_overlap: 0.7
output_action:
unverified_action: block
response:
include_verification_report: true

Supported fields

FieldTypeDefaultNotes
require_sourcesbooleantrueCitations that the policy finds are necessary when verification runs.
require_source_matchbooleantrueCan also be supplied in verification.require_source_match.
min_confidencenumber0.8Used for claim-confidence checks.
min_groundednessnumber0.8Is also a compatibility fallback for rag_context.min_context_overlap.
extract_patternsstring[]['case_law','academic','url','quote','statistic']Can also be supplied in verification.extract_patterns.
rag_context.verify_against_contextbooleantrueEnables groundedness evaluation against the given context documents.
rag_context.min_context_overlapnumber0.7Governs the context-overlap threshold.
output_action.unverified_actionflag | redact | blockflagOnly block changes the verdict. redact does not change output.
response.include_verification_reportbooleantrueWhen false, result details contain only a minimum payload.

How it works

  1. The gateway gets assistant text from the upstream response.
  2. If rag_context.verify_against_context is enabled, it reads context documents from the request.
  3. It gets supported citation patterns from the configured public set.
  4. It calculates groundedness and claim-confidence details.
  5. The output is verified only when the configured citation/context requirements pass.
  6. The gateway blocks only when the output is unverified and output_action.unverified_action is block.

Important behavior notes

  • Other output_action.unverified_action values keep the verdict as allow. They do not redact the response body.
  • Verified responses include a verification_report unless response.include_verification_report is disabled.

Example scenarios

Block unverified outputs

policy:
citation-verifier:
require_sources: true
require_source_match: true
output_action:
unverified_action: block

Context-only verification with minimal details

policy:
citation-verifier:
require_sources: false
rag_context:
verify_against_context: true
min_context_overlap: 0.7
response:
include_verification_report: false

Best practices

  • Use output_action.unverified_action: block when groundedness is mandatory.
  • Keep require_source_match: true for controlled or citation-sensitive outputs.
  • Give request-side context documents if context grounding must be part of verification.
  • Keep extract_patterns to the documented public values and rely on request-side context when groundedness is necessary.

Next steps