Files

54 lines
1.3 KiB
Python
Raw Permalink Normal View History

class LLMError(ValueError):
2023-05-15 08:51:32 +08:00
"""Base class for all LLM exceptions."""
description: str = ""
2023-05-15 08:51:32 +08:00
def __init__(self, description: str = ""):
2023-05-15 08:51:32 +08:00
self.description = description
class LLMBadRequestError(LLMError):
"""Raised when the LLM returns bad request."""
2023-05-15 08:51:32 +08:00
description = "Bad Request"
class ProviderTokenNotInitError(ValueError):
2023-05-15 08:51:32 +08:00
"""
Custom exception raised when the provider token is not initialized.
"""
2023-05-15 08:51:32 +08:00
description = "Provider Token Not Init"
2026-09-19 09:26:15 +00:00
def __init__(self, *args: object, **kwargs: object):
self.description = str(args[0]) if args else self.description
2023-07-17 00:14:19 +08:00
2023-05-15 08:51:32 +08:00
class QuotaExceededError(ValueError):
2023-05-15 08:51:32 +08:00
"""
Custom exception raised when the quota for a provider has been exceeded.
"""
2023-05-15 08:51:32 +08:00
description = "Quota Exceeded"
class AppInvokeQuotaExceededError(ValueError):
2024-07-10 13:31:35 +00:00
"""
Custom exception raised when the quota for an app has been exceeded.
"""
2024-07-10 13:31:35 +00:00
description = "App Invoke Quota Exceeded"
class ModelCurrentlyNotSupportError(ValueError):
2023-05-15 08:51:32 +08:00
"""
Custom exception raised when the model not support
"""
2023-05-15 08:51:32 +08:00
description = "Model Currently Not Support"
2024-08-26 19:36:44 +08:00
class InvokeRateLimitError(ValueError):
2024-08-26 19:36:44 +08:00
"""Raised when the Invoke returns rate limit error."""
2024-08-26 19:36:44 +08:00
description = "Rate Limit Error"