Skip to contents

This compatibility wrapper delegates to secure_chat() with provider = "ollama". New code should use that common provider path.

Usage

shield_ollama(
  prompt,
  policy = "enterprise_default",
  checks = "both",
  model = NULL,
  context = NULL,
  redaction = NULL,
  scanners = scanner_options(),
  show_tokens = FALSE,
  audit_content = c("metadata", "full"),
  show_stats = 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.

audit_content

Passed to secure_chat(); defaults to metadata-only audit content.

show_stats

Show execution statistics as messages.

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.")
} # }