nat.plugins.security.middleware.guardrails.exceptions#

Exceptions raised by the NeMo Guardrails middleware.

Exceptions#

PostInvokeBlockedError

Raised by on_post_invoke_blocked when a post_invoke rail blocks the function output.

Module Contents#

exception PostInvokeBlockedError(message: str)#

Bases: RuntimeError

Raised by on_post_invoke_blocked when a post_invoke rail blocks the function output.

Carries the rail’s message so callers can surface it or re-raise as appropriate. Override GuardrailsMiddleware.on_post_invoke_blocked to return a value instead.

Initialize self. See help(type(self)) for accurate signature.

block_message: str#