azad.ainetwork.errors Module¶
azad.ainetwork.errors ¶
Classes¶
AINetworkError ¶
Bases: Exception
Base error class for AINetwork exceptions.
Source code in azad/ainetwork/errors.py
AIAuthenticationError ¶
Bases: AINetworkError
Raised when authentication fails.
Source code in azad/ainetwork/errors.py
AIInvalidRequestError ¶
Bases: AINetworkError
Raised when the request is malformed or invalid.
Source code in azad/ainetwork/errors.py
AIRateLimitError ¶
Bases: AINetworkError
Raised when rate limits have been exceeded.
Source code in azad/ainetwork/errors.py
AIServiceUnavailableError ¶
Bases: AINetworkError
Raised when the underlying service is temporarily unavailable.
Source code in azad/ainetwork/errors.py
AITimeoutError ¶
Bases: AINetworkError
Raised when the request or streaming times out.
Source code in azad/ainetwork/errors.py
AIConnectionError ¶
Bases: AINetworkError
Raised when a network connection error occurs.
Source code in azad/ainetwork/errors.py
AIInvalidResponseError ¶
Bases: AINetworkError
Raised when an invalid response is received from the API.
Source code in azad/ainetwork/errors.py
AIProviderError ¶
Bases: AINetworkError
Raised when a provider-specific error occurs.
Source code in azad/ainetwork/errors.py
AIInsufficientCreditsError ¶
Bases: AINetworkError
Raised when the user doesn't have enough credits.
Source code in azad/ainetwork/errors.py
AIUserNotFoundError ¶
Bases: AINetworkError
Raised when the user is not found.
Source code in azad/ainetwork/errors.py
AINetwork ¶
Functions¶
complete
async
¶
Wraps litellm.exceptions.accompletion. It first makes the initial call (one line) and then loops over the asynchronous iterator to process streaming tokens.
All litellm errors are caught and re-raised as custom AINetwork errors, with the default error message defined in the error class and the original exception appended automatically.
Source code in azad/ainetwork/errors.py
Functions¶
create ¶
create(err: Exception) -> AINetworkError
Creates a wrapping error for a litellm error using a match statement.