mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-07-31 16:01:46 +00:00
use correct shield impl in meta ref
This commit is contained in:
parent
874206baeb
commit
b5d130fe2a
1 changed files with 5 additions and 2 deletions
|
@ -64,11 +64,14 @@ class MetaReferenceSafetyImpl(Safety, ShieldsProtocolPrivate):
|
||||||
# TODO: we can refactor ShieldBase, etc. to be inline with the API types
|
# TODO: we can refactor ShieldBase, etc. to be inline with the API types
|
||||||
res = await shield_impl.run(messages)
|
res = await shield_impl.run(messages)
|
||||||
violation = None
|
violation = None
|
||||||
if res.is_violation and shield.on_violation_action != OnViolationAction.IGNORE:
|
if (
|
||||||
|
res.is_violation
|
||||||
|
and shield_impl.on_violation_action != OnViolationAction.IGNORE
|
||||||
|
):
|
||||||
violation = SafetyViolation(
|
violation = SafetyViolation(
|
||||||
violation_level=(
|
violation_level=(
|
||||||
ViolationLevel.ERROR
|
ViolationLevel.ERROR
|
||||||
if shield.on_violation_action == OnViolationAction.RAISE
|
if shield_impl.on_violation_action == OnViolationAction.RAISE
|
||||||
else ViolationLevel.WARN
|
else ViolationLevel.WARN
|
||||||
),
|
),
|
||||||
user_message=res.violation_return_message,
|
user_message=res.violation_return_message,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue