nemoguardrails.exceptions

View as Markdown

Module Contents

Classes

NameDescription
ConfigurationErrorBase class for Guardrails Configuration validation errors.
InvalidModelConfigurationErrorRaised when a guardrail configuration’s model is invalid.
InvalidRailsConfigurationErrorRaised when rails configuration is invalid.
InvalidStateErrorRaised when a caller-supplied state argument is not valid public input.
LLMAuthenticationError-
LLMBadRequestError-
LLMCallExceptionA wrapper around the LLM call invocation exception.
LLMClientErrorBase class for LLM client errors.
LLMConnectionError-
LLMContextWindowError-
LLMRateLimitError-
LLMResponseValidationError-
LLMServerError-
LLMTimeoutError-
LLMUnsupportedParamsError-
StreamingNotSupportedErrorRaised when streaming is requested but not supported by the configuration.

Data

__all__

API

class nemoguardrails.exceptions.ConfigurationError()

Bases: ValueError

Base class for Guardrails Configuration validation errors.

class nemoguardrails.exceptions.InvalidModelConfigurationError()

Bases: ConfigurationError

Raised when a guardrail configuration’s model is invalid.

class nemoguardrails.exceptions.InvalidRailsConfigurationError()

Bases: ConfigurationError

Raised when rails configuration is invalid.

Examples:

- Input/output rail references a model that doesn't exist in config
- Rail references a flow that doesn't exist
- Missing required prompt template
- Invalid rail parameters
class nemoguardrails.exceptions.InvalidStateError()

Bases: ValueError

Raised when a caller-supplied state argument is not valid public input.

The serialized Colang 2.0 runtime State carries trusted control-plane fields (flow_configs, rails_config, in-flight flow execution) and must not come from an untrusted caller. Stateful 2.x execution uses process_events_async, which keeps a live State object in the trusted Python process.

class nemoguardrails.exceptions.LLMAuthenticationError()
class nemoguardrails.exceptions.LLMBadRequestError()
class nemoguardrails.exceptions.LLMCallException(
inner_exception: typing.Union[BaseException, str],
detail: typing.Optional[str] = None
)
Exception

Bases: Exception

A wrapper around the LLM call invocation exception.

This is used to propagate the exception out of the generate_async call. The default behavior is to catch it and return an “Internal server error.” message.

class nemoguardrails.exceptions.LLMClientError(
status_code: int,
error_message: str,
error_type: typing.Optional[str] = None,
error_code: typing.Optional[str] = None,
param: typing.Optional[str] = None,
body: typing.Optional[dict] = None,
response_headers: typing.Optional[dict] = None,
model_name: typing.Optional[str] = None,
provider_name: typing.Optional[str] = None,
base_url: typing.Optional[str] = None
)
Exception

Bases: Exception

Base class for LLM client errors.

status_code holds the HTTP response status when one was received, or 0 when no response arrived (client-side timeout or network error). Callers should branch on exception class rather than status_code to distinguish HTTP vs network failures, the type hierarchy is the authoritative discriminator.

nemoguardrails.exceptions.LLMClientError.__str__() -> str
class nemoguardrails.exceptions.LLMConnectionError()
class nemoguardrails.exceptions.LLMContextWindowError()
class nemoguardrails.exceptions.LLMRateLimitError(
status_code: int,
error_message: str,
error_type: typing.Optional[str] = None,
error_code: typing.Optional[str] = None,
param: typing.Optional[str] = None,
body: typing.Optional[dict] = None,
response_headers: typing.Optional[dict] = None,
model_name: typing.Optional[str] = None,
provider_name: typing.Optional[str] = None,
base_url: typing.Optional[str] = None,
retry_after_seconds: typing.Optional[float] = None
)
class nemoguardrails.exceptions.LLMResponseValidationError(
message: str,
response_data: typing.Optional[dict] = None,
model_name: typing.Optional[str] = None,
provider_name: typing.Optional[str] = None,
base_url: typing.Optional[str] = None
)
class nemoguardrails.exceptions.LLMServerError()
class nemoguardrails.exceptions.LLMTimeoutError()
class nemoguardrails.exceptions.LLMUnsupportedParamsError()
class nemoguardrails.exceptions.StreamingNotSupportedError()

Bases: InvalidRailsConfigurationError

Raised when streaming is requested but not supported by the configuration.

nemoguardrails.exceptions.__all__ = ['ConfigurationError', 'InvalidModelConfigurationError', 'InvalidRailsConfigurat...