Enumerations Classes

Smarter API Guardrail Manifest - enumerated datatypes.

Note

Experimental. The Guardrail was designed and coded by Claude Code (Anthropic’s Claude Opus 5.5), with Lawrence McDaniel as co-author. It is experimental, and will be documented.

class smarter.apps.guardrail.manifest.enum.SAMGuardrailAction(*values)[source]

Bases: SmarterEnumAbstract

What a guardrail does when it triggers.

  • log: record the event only.

  • flag: record the event for review, and continue.

  • redact: replace every match with replacement, and continue.

  • transform: replace every match with replacement, which for the regex strategy may refer to groups, e.g. \1, and continue.

  • block: stop, and return message instead of the LLM’s reply.

  • escalate: record the event for human review, notify reviewers, and continue.

BLOCK = 'block'
ESCALATE = 'escalate'
FLAG = 'flag'
LOG = 'log'
REDACT = 'redact'
TRANSFORM = 'transform'
class smarter.apps.guardrail.manifest.enum.SAMGuardrailCategory(*values)[source]

Bases: SmarterEnumAbstract

The risk that a guardrail addresses.

It classifies findings, and does not change behavior.

COMPLIANCE = 'compliance'
CUSTOM = 'custom'
FORMATTING = 'formatting'
HALLUCINATION = 'hallucination'
JAILBREAK = 'jailbreak'
OFF_TOPIC = 'off_topic'
PII = 'pii'
PROMPT_INJECTION = 'prompt_injection'
SECRETS = 'secrets'
SELF_HARM = 'self_harm'
TOXICITY = 'toxicity'
class smarter.apps.guardrail.manifest.enum.SAMGuardrailDetector(*values)[source]

Bases: SmarterEnumAbstract

The built-in detectors of the detector strategy.

API_KEY = 'api_key'
AWS_ACCESS_KEY = 'aws_access_key'
CREDIT_CARD = 'credit_card'
EMAIL = 'email'
IBAN = 'iban'
IP_ADDRESS = 'ip_address'
JWT = 'jwt'
PASSWORD_ASSIGNMENT = 'password_assignment'
PHONE_NUMBER = 'phone_number'
PRIVATE_KEY = 'private_key'
US_SSN = 'us_ssn'
class smarter.apps.guardrail.manifest.enum.SAMGuardrailMode(*values)[source]

Bases: SmarterEnumAbstract

Whether a guardrail acts.

  • enforce: it takes its action.

  • monitor: it only records what its action would have been, to evaluate a new guardrail against real traffic before enforcing it.

ENFORCE = 'enforce'
MONITOR = 'monitor'
class smarter.apps.guardrail.manifest.enum.SAMGuardrailModerationCategory(*values)[source]

Bases: SmarterEnumAbstract

The categories of OpenAI’s moderation models.

HARASSMENT = 'harassment'
HARASSMENT_THREATENING = 'harassment/threatening'
HATE = 'hate'
HATE_THREATENING = 'hate/threatening'
ILLICIT = 'illicit'
ILLICIT_VIOLENT = 'illicit/violent'
SELF_HARM = 'self-harm'
SELF_HARM_INSTRUCTIONS = 'self-harm/instructions'
SELF_HARM_INTENT = 'self-harm/intent'
SEXUAL = 'sexual'
SEXUAL_MINORS = 'sexual/minors'
VIOLENCE = 'violence'
VIOLENCE_GRAPHIC = 'violence/graphic'
class smarter.apps.guardrail.manifest.enum.SAMGuardrailStage(*values)[source]

Bases: SmarterEnumAbstract

When a guardrail runs.

  • input: on the user’s message, before it is sent to the LLM.

  • output: on the LLM’s reply, before it is returned to the user.

  • both: on both.

BOTH = 'both'
INPUT = 'input'
OUTPUT = 'output'
class smarter.apps.guardrail.manifest.enum.SAMGuardrailStrategy(*values)[source]

Bases: SmarterEnumAbstract

How a guardrail detects what it guards against.

  • regex: a regular expression.

  • keyword: a list of words or phrases.

  • detector: built-in, validated detectors of personal data and secrets, e.g. credit card numbers that pass the Luhn check.

  • semantic: embedding similarity to reference examples.

  • moderation: an LLM provider’s moderation model, e.g. OpenAI’s omni-moderation.

  • llm_judge: an LLM that judges the text, with a prompt.

regex, keyword and detector are deterministic, fast and free. The others call an LLM provider, and add latency and cost to each prompt.

DETECTOR = 'detector'
KEYWORD = 'keyword'
LLM_JUDGE = 'llm_judge'
MODERATION = 'moderation'
REGEX = 'regex'
SEMANTIC = 'semantic'
classmethod locating()[source]

Return the strategies that locate the text they match, as redact and transform require.

Return type:

list[str]

classmethod scored()[source]

Return the strategies that produce a confidence score, and use threshold.

Return type:

list[str]