Files
AI/참고/guardrails-main/guardrails/utils/on_fail.py
2026-05-12 19:40:31 +09:00

12 lines
337 B
Python

from typing import Literal, get_args
ON_FAIL_TYPES = Literal[
"exception", "fix", "fix_reask", "reask", "filter", "refrain", "noop", "custom"
]
def on_fail(fix_type: ON_FAIL_TYPES = "noop"):
options = get_args(ON_FAIL_TYPES)
assert fix_type in options, f"'{fix_type}' is not in {options}"
return {"on_fail": fix_type}