Skip to content

Exceptions

Provides custom exception classes, error handling and parsing utilities.

APIConnectionError(class_name, debug_info=None)

Bases: BaseInvokerError

Exception for when the client fails to connect to the model provider.

Initialize APIConnectionError.

Parameters:

Name Type Description Default
class_name str

The name of the class that raised the error.

required
debug_info dict[str, Any] | None

Additional debug information for developers. Defaults to None.

None

APITimeoutError(class_name, debug_info=None)

Bases: BaseInvokerError

Exception for when the request to the model provider times out.

Initialize APITimeoutError.

Parameters:

Name Type Description Default
class_name str

The name of the class that raised the error.

required
debug_info dict[str, Any] | None

Additional debug information for developers. Defaults to None.

None

BaseInvokerError(class_name, message, debug_info=None)

Bases: Exception

Base exception class for all gllm_inference invoker errors.

Initialize the base exception.

Parameters:

Name Type Description Default
class_name str

The name of the class that raised the error.

required
message str

The error message.

required
debug_info dict[str, Any] | None

Additional debug information for developers. Defaults to None.

None

verbose()

Verbose error message with debug information.

Returns:

Name Type Description
str str

The verbose error message with debug information.

InvokerRuntimeError(class_name, debug_info=None)

Bases: BaseInvokerError

Exception for runtime errors that occur during the invocation of the model.

Initialize the InvokerRuntimeError.

Parameters:

Name Type Description Default
class_name str

The name of the class that raised the error.

required
debug_info dict[str, Any] | None

Additional debug information for developers. Defaults to None.

None

ModelNotFoundError(class_name, debug_info=None)

Bases: BaseInvokerError

Exception for model not found errors.

Initialize ModelNotFoundError.

Parameters:

Name Type Description Default
class_name str

The name of the class that raised the error.

required
debug_info dict[str, Any] | None

Additional debug information for developers. Defaults to None.

None

ProviderAuthError(class_name, debug_info=None)

Bases: BaseInvokerError

Exception for authorization failures due to API key issues.

Initialize ProviderAuthError.

Parameters:

Name Type Description Default
class_name str

The name of the class that raised the error.

required
debug_info dict[str, Any] | None

Additional debug information for developers. Defaults to None.

None

ProviderConflictError(class_name, debug_info=None)

Bases: BaseInvokerError

Exception for when the request to the model provider conflicts.

Initialize ProviderConflictError.

Parameters:

Name Type Description Default
class_name str

The name of the class that raised the error.

required
debug_info dict[str, Any] | None

Additional debug information for developers. Defaults to None.

None

ProviderInternalError(class_name, debug_info=None)

Bases: BaseInvokerError

Exception for unexpected server-side errors.

Initialize ProviderInternalError.

Parameters:

Name Type Description Default
class_name str

The name of the class that raised the error.

required
debug_info dict[str, Any] | None

Additional debug information for developers. Defaults to None.

None

ProviderInvalidArgsError(class_name, debug_info=None)

Bases: BaseInvokerError

Exception for bad or malformed requests, invalid parameters or structure.

Initialize ProviderInvalidArgsError.

Parameters:

Name Type Description Default
class_name str

The name of the class that raised the error.

required
debug_info dict[str, Any] | None

Additional debug information for developers. Defaults to None.

None

ProviderOverloadedError(class_name, debug_info=None)

Bases: BaseInvokerError

Exception for when the engine is currently overloaded.

Initialize ProviderOverloadedError.

Parameters:

Name Type Description Default
class_name str

The name of the class that raised the error.

required
debug_info dict[str, Any] | None

Additional debug information for developers. Defaults to None.

None

ProviderRateLimitError(class_name, debug_info=None)

Bases: BaseInvokerError

Exception for rate limit violations.

Initialize ProviderRateLimitError.

Parameters:

Name Type Description Default
class_name str

The name of the class that raised the error.

required
debug_info dict[str, Any] | None

Additional debug information for developers. Defaults to None.

None

build_debug_info(error, class_name)

Build debug information for an error.

Parameters:

Name Type Description Default
error Any

The error to extract debug information from.

required
class_name str

The name of the class that raised the error.

required

Returns:

Type Description
dict[str, Any]

dict[str, Any]: A dictionary containing debug information about the error.

convert_http_status_to_base_invoker_error(error, invoker, status_code_extractor=None, provider_error_mapping=ALL_PROVIDER_ERROR_MAPPINGS)

Extract provider error with HTTP status code fallback pattern.

This function implements the common pattern used by Bedrock and Google invokers where they first try to extract HTTP status codes, then fall back to provider-specific error mappings based on exception keys.

Parameters:

Name Type Description Default
error Exception

The error to convert.

required
invoker BaseEMInvoker | BaseLMInvoker

The invoker instance that raised the error.

required
status_code_extractor callable

Function to extract status code from error.

None
provider_error_mapping dict

Provider-specific error mapping dictionary.

ALL_PROVIDER_ERROR_MAPPINGS

Returns:

Name Type Description
BaseInvokerError BaseInvokerError

The converted error.

convert_to_base_invoker_error(error, invoker)

Convert provider error into BaseInvokerError.

Parameters:

Name Type Description Default
error Exception

The error to convert.

required
invoker BaseEMInvoker | BaseLMInvoker

The invoker instance that raised the error.

required

Returns:

Name Type Description
BaseInvokerError BaseInvokerError

The converted error.