remote_reviewer() creates a reviewer function backed by an HTTP endpoint.
It is intended for teams that already have a policy service, review gateway,
or hosted model wrapper that returns llmshieldr-compatible JSON findings.
Usage
remote_reviewer(
url,
headers = list(),
body_field = "prompt",
response_path = NULL,
timeout = 30,
destination_policy = url_policy(),
show_stats = FALSE
)Arguments
- url
Endpoint URL.
- headers
Named character vector or list of HTTP headers.
- body_field
JSON field name used for the reviewer prompt.
- response_path
Optional character vector path to extract from a JSON response, such as
c("data", "findings").- timeout
Request timeout in seconds.
- destination_policy
URL policy applied to the endpoint before the reviewer function is created. The default permits public HTTPS endpoints.
- show_stats
Show per-request time, token estimate, network status, and HTTP body transfer rates as messages.
Value
A reviewer function suitable for reviewer = in scan_prompt(),
scan_output(), scan_context(), or secure_chat().
Details
The returned function accepts the reviewer prompt generated by llmshieldr and
sends a JSON body to url. By default, the body is:
The endpoint may return either a JSON response body or plain text containing
JSON. If the response body is JSON and response_path is supplied, the value
at that path is extracted before returning to the scanner. Otherwise the
response body is returned as text and parsed by llmshieldr's semantic-review
JSON extraction logic.
This helper requires the optional httr2 package and performs no network
calls until the reviewer function is invoked. destination_policy performs
a URL preflight without DNS lookup; deployments should still enforce egress
policy and validate connection-time DNS and redirect evidence.
Examples
if (FALSE) { # \dontrun{
reviewer <- remote_reviewer(
"https://policy.example.com/review",
headers = c(Authorization = "Bearer <token>")
)
scan_prompt("Review me", reviewer = reviewer, checks = "llm")
} # }
