mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-12 03:48:56 +00:00
refactor(types): move CommonProxyErrors into litellm/types/proxy (#45745)
Part of LIT-9423
This commit is contained in:
parent
396e8d1e6c
commit
38880fd5ce
4 changed files with 21 additions and 15 deletions
|
|
@ -26,8 +26,8 @@ else:
|
|||
|
||||
class GCSBucketLogger(GCSBucketBase, AdditionalLoggingUtils):
|
||||
def __init__(self, bucket_name: str | None = None) -> None:
|
||||
from litellm.proxy._types import CommonProxyErrors
|
||||
from litellm.proxy.proxy_server import premium_user
|
||||
from litellm.types.proxy.common_proxy_errors import CommonProxyErrors
|
||||
|
||||
self.batch_size = int(os.getenv("GCS_BATCH_SIZE", GCS_DEFAULT_BATCH_SIZE))
|
||||
self.flush_interval = int(os.getenv("GCS_FLUSH_INTERVAL", GCS_DEFAULT_FLUSH_INTERVAL_SECONDS))
|
||||
|
|
@ -52,8 +52,8 @@ class GCSBucketLogger(GCSBucketBase, AdditionalLoggingUtils):
|
|||
|
||||
#### ASYNC ####
|
||||
async def async_log_success_event(self, kwargs, response_obj, start_time, end_time):
|
||||
from litellm.proxy._types import CommonProxyErrors
|
||||
from litellm.proxy.proxy_server import premium_user
|
||||
from litellm.types.proxy.common_proxy_errors import CommonProxyErrors
|
||||
|
||||
if premium_user is not True:
|
||||
raise ValueError(
|
||||
|
|
|
|||
|
|
@ -4345,18 +4345,9 @@ class ModelAccessDeniedProxyException(ProxyException):
|
|||
return self.internal_message.replace("\r", "").replace("\n", "")
|
||||
|
||||
|
||||
class CommonProxyErrors(str, enum.Enum):
|
||||
db_not_connected_error = (
|
||||
"DB not connected. This endpoint needs a database; set DATABASE_URL to a "
|
||||
"PostgreSQL connection string (postgresql://...) to enable it. "
|
||||
"See https://docs.litellm.ai/docs/proxy/virtual_keys"
|
||||
)
|
||||
no_llm_router = "No models configured on proxy"
|
||||
not_allowed_access = "Admin-only endpoint. Not allowed to access this."
|
||||
not_premium_user = "You must be a LiteLLM Enterprise user to use this feature. If you have a license please set `LITELLM_LICENSE` in your env. Get a 7 day trial key here: https://www.litellm.ai/enterprise#trial. \nPricing: https://www.litellm.ai/#pricing"
|
||||
max_parallel_request_limit_reached = "Crossed TPM / RPM / Max Parallel Request Limit"
|
||||
missing_enterprise_package = "Missing litellm-enterprise package. Please install it to use this feature. Run `pip install litellm-enterprise`"
|
||||
missing_enterprise_package_docker = "This uses the enterprise folder - only available on the Docker image."
|
||||
from litellm.types.proxy.common_proxy_errors import ( # noqa: E402 # public re-export
|
||||
CommonProxyErrors as CommonProxyErrors, # noqa: PLC0414 # public re-export
|
||||
)
|
||||
|
||||
|
||||
class SpendCalculateRequest(LiteLLMPydanticObjectBase):
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ from litellm.caching.caching import InMemoryCache
|
|||
from litellm.constants import SECRET_MANAGER_REFRESH_INTERVAL
|
||||
from litellm.integrations.gcs_bucket.gcs_bucket_base import GCSBucketBase
|
||||
from litellm.llms.custom_httpx.http_handler import get_httpx_client
|
||||
from litellm.proxy._types import CommonProxyErrors
|
||||
from litellm.types.proxy.common_proxy_errors import CommonProxyErrors
|
||||
from litellm.types.secret_managers.main import KeyManagementSystem
|
||||
|
||||
|
||||
|
|
|
|||
15
litellm/types/proxy/common_proxy_errors.py
Normal file
15
litellm/types/proxy/common_proxy_errors.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import enum
|
||||
|
||||
|
||||
class CommonProxyErrors(str, enum.Enum):
|
||||
db_not_connected_error = (
|
||||
"DB not connected. This endpoint needs a database; set DATABASE_URL to a "
|
||||
"PostgreSQL connection string (postgresql://...) to enable it. "
|
||||
"See https://docs.litellm.ai/docs/proxy/virtual_keys"
|
||||
)
|
||||
no_llm_router = "No models configured on proxy"
|
||||
not_allowed_access = "Admin-only endpoint. Not allowed to access this."
|
||||
not_premium_user = "You must be a LiteLLM Enterprise user to use this feature. If you have a license please set `LITELLM_LICENSE` in your env. Get a 7 day trial key here: https://www.litellm.ai/enterprise#trial. \nPricing: https://www.litellm.ai/#pricing"
|
||||
max_parallel_request_limit_reached = "Crossed TPM / RPM / Max Parallel Request Limit"
|
||||
missing_enterprise_package = "Missing litellm-enterprise package. Please install it to use this feature. Run `pip install litellm-enterprise`"
|
||||
missing_enterprise_package_docker = "This uses the enterprise folder - only available on the Docker image."
|
||||
Loading…
Add table
Reference in a new issue