Module: Olyx::Guardrails::ViolationLabels

Defined in:
lib/olyx/guardrails/violation_labels.rb

Overview

Derives shared machine-readable violation labels from a decision.

Constant Summary collapse

MAPPINGS =
{
  injection_attempt: 'injection_attempt',
  secret_leaked: 'secret_leaked',
  pii_detected: 'pii_detected',
  policy_violated: 'restricted_content'
}.freeze

Class Method Summary collapse

Class Method Details

.call(result) ⇒ Object



18
19
20
21
# File 'lib/olyx/guardrails/violation_labels.rb', line 18

def call(result)
  labels = MAPPINGS.filter_map { |field, label| label if result[field] }
  labels.concat(SupplementalViolationLabels.call(result))
end