toxicity#
enkrypt.toxicity(*, on_violation="block", on_error="block")
Flags hateful, harassing, violent or otherwise toxic text.
Allowed actions |
|
Default action |
|
Enkrypt detector |
|
Enkrypt reports which kinds of toxicity it found; they appear in the guard’s message and in the full response on a raised exception.
Where to use it#
On the answer, so the agent never says something toxic.
retryasks the model to answer again rather than failing the run:OutputGuardrail(guard=[enkrypt.toxicity(on_violation="retry")])
On the prompt, to refuse abusive input before spending a model call on it:
InputGuardrail(guard=[enkrypt.toxicity()])
On the answer, block raises OutputBlocked; see Actions.