You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. class LLMError(ValueError):
  2. """Base class for all LLM exceptions."""
  3. description: str | None = None
  4. def __init__(self, description: str | None = None):
  5. self.description = description
  6. class LLMBadRequestError(LLMError):
  7. """Raised when the LLM returns bad request."""
  8. description = "Bad Request"
  9. class ProviderTokenNotInitError(ValueError):
  10. """
  11. Custom exception raised when the provider token is not initialized.
  12. """
  13. description = "Provider Token Not Init"
  14. def __init__(self, *args, **kwargs):
  15. self.description = args[0] if args else self.description
  16. class QuotaExceededError(ValueError):
  17. """
  18. Custom exception raised when the quota for a provider has been exceeded.
  19. """
  20. description = "Quota Exceeded"
  21. class AppInvokeQuotaExceededError(ValueError):
  22. """
  23. Custom exception raised when the quota for an app has been exceeded.
  24. """
  25. description = "App Invoke Quota Exceeded"
  26. class ModelCurrentlyNotSupportError(ValueError):
  27. """
  28. Custom exception raised when the model not support
  29. """
  30. description = "Model Currently Not Support"
  31. class InvokeRateLimitError(ValueError):
  32. """Raised when the Invoke returns rate limit error."""
  33. description = "Rate Limit Error"