Exceptions

Guardrail exceptions.

exception smarter.apps.guardrail.exceptions.SmarterGuardrailException(message='')[source]

Bases: SmarterException

Base class for all guardrail exceptions.

Exceptions raised by the Guardrail service.

exception smarter.apps.guardrail.services.exceptions.GuardrailBlockedError(message, guardrail_name=None)[source]

Bases: GuardrailServiceError

Raised by the prompt pipeline when an input guardrail blocks the user’s message.

Parameters:
  • message (str) – The user-facing message to return instead of the LLM’s reply.

  • guardrail_name (str | None) – The name of the guardrail that blocked the message.

__init__(message, guardrail_name=None)[source]
exception smarter.apps.guardrail.services.exceptions.GuardrailConfigError[source]

Bases: GuardrailServiceError

Raised for a Guardrail whose configuration is.

invalid or incomplete for its strategy, e.g. strategy=regex without a pattern.

Manifests are validated when they are applied, so this indicates a Guardrail that was changed outside of a manifest, e.g. in the Django admin.

exception smarter.apps.guardrail.services.exceptions.GuardrailProviderError[source]

Bases: GuardrailServiceError

Raised when a strategy’s call to an LLM provider fails, or returns an unusable result.

exception smarter.apps.guardrail.services.exceptions.GuardrailServiceError[source]

Bases: Exception

Base class for all guardrail-service errors.

exception smarter.apps.guardrail.services.exceptions.GuardrailStrategyNotImplementedError[source]

Bases: GuardrailServiceError

Raised when a Guardrail’s strategy has no implementation.