Nous.Plugins.InputGuard.Strategies.LLMJudge (nous v0.17.2)

Copy Markdown View Source

LLM-based input classification strategy.

Uses a secondary LLM call via Nous.generate_text/3 to classify whether user input is safe, suspicious, or should be blocked. The LLM is prompted to return a structured VERDICT: safe|suspicious|blocked response.

Configuration

  • :model — Required. Model string for the judge LLM (e.g., "openai:gpt-4o-mini").
  • :system_prompt — Override the default classification system prompt.
  • :temperature — LLM temperature. Default: 0.0
  • :on_error — What happens when the judge cannot produce a verdict (the LLM call fails, raises, or returns something without a VERDICT: line):
    • :drop (default) — the strategy returns {:error, reason} and Nous.Plugins.InputGuard counts it as dropped: no verdict was produced, which under the default :any aggregation fails closed by upgrading a :safe aggregate to :suspicious (see :fail_closed there). This is the safe default — a judge that is down must not read as a judge that said "safe".
    • :safe — fail open: return a :safe verdict. Explicit opt-in.
    • :suspicious / :blocked — return a verdict of that severity.

Example

{Nous.Plugins.InputGuard.Strategies.LLMJudge,
  model: "openai:gpt-4o-mini",
  on_error: :blocked}