Skip to contents

Convenience wrapper that creates separate ellmer Ollama chats for the assistant and semantic reviewer, then delegates to secure_chat().

Usage

shield_ollama(
  prompt,
  policy = "enterprise_default",
  checks = "both",
  model = NULL,
  context = NULL,
  redaction = NULL,
  scanners = scanner_options(),
  show_tokens = FALSE
)

Arguments

prompt

User prompt.

policy

A shieldr_policy or built-in policy name such as "comprehensive".

checks

One of "rules", "nlp", "llm", or "both".

model

Ollama model name. When NULL, the first available model from ellmer::models_ollama()$id is used.

context

Optional data frame of retrieved context.

redaction

Optional redaction strategy from redaction_strategy().

scanners

Optional scanner configuration from scanner_options().

show_tokens

Whether to attach token counts when ellmer is available.

Value

A shieldr_result.

Details

This is an optional local-model path. It requires the suggested ellmer package and a running Ollama installation. Two chats are created: one for the assistant response and one for reviewer checks. Keeping them separate avoids mixing safety-review instructions into the assistant's conversation state.

For an existing chat object, use secure_chat() directly.

Examples

if (FALSE) { # \dontrun{
shield_ollama("Summarise this safely.")
} # }