|
|
|
|
|
|
|
|
from typing import Optional |
|
|
from typing import Optional |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class LLMError(Exception): |
|
|
|
|
|
|
|
|
class LLMError(ValueError): |
|
|
"""Base class for all LLM exceptions.""" |
|
|
"""Base class for all LLM exceptions.""" |
|
|
|
|
|
|
|
|
description: Optional[str] = None |
|
|
description: Optional[str] = None |
|
|
|
|
|
|
|
|
description = "Bad Request" |
|
|
description = "Bad Request" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ProviderTokenNotInitError(Exception): |
|
|
|
|
|
|
|
|
class ProviderTokenNotInitError(ValueError): |
|
|
""" |
|
|
""" |
|
|
Custom exception raised when the provider token is not initialized. |
|
|
Custom exception raised when the provider token is not initialized. |
|
|
""" |
|
|
""" |
|
|
|
|
|
|
|
|
self.description = args[0] if args else self.description |
|
|
self.description = args[0] if args else self.description |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class QuotaExceededError(Exception): |
|
|
|
|
|
|
|
|
class QuotaExceededError(ValueError): |
|
|
""" |
|
|
""" |
|
|
Custom exception raised when the quota for a provider has been exceeded. |
|
|
Custom exception raised when the quota for a provider has been exceeded. |
|
|
""" |
|
|
""" |
|
|
|
|
|
|
|
|
description = "Quota Exceeded" |
|
|
description = "Quota Exceeded" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class AppInvokeQuotaExceededError(Exception): |
|
|
|
|
|
|
|
|
class AppInvokeQuotaExceededError(ValueError): |
|
|
""" |
|
|
""" |
|
|
Custom exception raised when the quota for an app has been exceeded. |
|
|
Custom exception raised when the quota for an app has been exceeded. |
|
|
""" |
|
|
""" |
|
|
|
|
|
|
|
|
description = "App Invoke Quota Exceeded" |
|
|
description = "App Invoke Quota Exceeded" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ModelCurrentlyNotSupportError(Exception): |
|
|
|
|
|
|
|
|
class ModelCurrentlyNotSupportError(ValueError): |
|
|
""" |
|
|
""" |
|
|
Custom exception raised when the model not support |
|
|
Custom exception raised when the model not support |
|
|
""" |
|
|
""" |
|
|
|
|
|
|
|
|
description = "Model Currently Not Support" |
|
|
description = "Model Currently Not Support" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class InvokeRateLimitError(Exception): |
|
|
|
|
|
|
|
|
class InvokeRateLimitError(ValueError): |
|
|
"""Raised when the Invoke returns rate limit error.""" |
|
|
"""Raised when the Invoke returns rate limit error.""" |
|
|
|
|
|
|
|
|
description = "Rate Limit Error" |
|
|
description = "Rate Limit Error" |