Skip to contents

A shieldr_report is the scanner result returned by scan_prompt(), scan_context(), and scan_output().

Usage

shieldr_report(
  action,
  text_clean,
  findings,
  risk_score,
  policy,
  checks,
  timestamp = .now_iso(),
  tokens = NULL,
  metadata = list()
)

Arguments

action

Resolved action: "allow", "redact", or "block".

text_clean

Cleaned or redacted text.

findings

A list of finding lists.

risk_score

Numeric risk score between 0 and 1.

policy

Policy name.

checks

Check mode used.

timestamp

ISO8601 timestamp.

tokens

Optional token count for the original text.

metadata

Optional list of operational metadata.

Value

A shieldr_report S3 object.

Details

Reports separate the cleaned text from the findings that explain why the text was allowed, redacted, or blocked. risk_score is a deterministic severity index from 0 to 1; it is not a probability. The checks field records whether the report came from deterministic rules, NLP checks, an LLM reviewer, or a combined mode. metadata carries optional operational details such as semantic reviewer parse errors, scanner settings, context row indexes, source labels, tool names, or conversation roles.

Examples

shieldr_report("allow", "hello", list(), 0, "custom", "rules")
#> llmshieldr report
#> action: allow
#> risk_score: 0.000
#> findings: 0