mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-24 18:24:20 +00:00
fix imports
This commit is contained in:
parent
5df4dcd33f
commit
6c0e1bd38b
12 changed files with 60 additions and 52 deletions
|
@ -27,7 +27,7 @@ from litellm.llms.custom_httpx.http_handler import (
|
|||
httpxSpecialProvider,
|
||||
)
|
||||
from litellm.types.integrations.slack_alerting import *
|
||||
from litellm_proxy._types import AlertType, CallInfo, VirtualKeyEvent, WebhookEvent
|
||||
from litellm.types.utils import CallInfo, VirtualKeyEvent, WebhookEvent
|
||||
|
||||
from ..email_templates.templates import *
|
||||
from .batching_handler import send_to_webhook, squash_payloads
|
||||
|
|
|
@ -6,7 +6,7 @@ import asyncio
|
|||
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union
|
||||
|
||||
from litellm.secret_managers.main import get_secret
|
||||
from litellm_proxy._types import AlertType
|
||||
from litellm.types.integrations.slack_alerting import AlertType
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from litellm.litellm_core_utils.litellm_logging import Logging as _Logging
|
||||
|
|
|
@ -12,7 +12,6 @@ from litellm.integrations.gcs_bucket.gcs_bucket_base import GCSBucketBase
|
|||
from litellm.types.integrations.base_health_check import IntegrationHealthCheckStatus
|
||||
from litellm.types.integrations.gcs_bucket import *
|
||||
from litellm.types.utils import StandardLoggingPayload
|
||||
from litellm_proxy._types import CommonProxyErrors
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from litellm.llms.vertex_ai.vertex_llm_base import VertexBase
|
||||
|
@ -22,7 +21,7 @@ else:
|
|||
|
||||
class GCSBucketLogger(GCSBucketBase, AdditionalLoggingUtils):
|
||||
def __init__(self, bucket_name: Optional[str] = None) -> None:
|
||||
from litellm_proxy.proxy_server import premium_user
|
||||
from litellm_proxy.proxy_server import CommonProxyErrors, premium_user
|
||||
|
||||
super().__init__(bucket_name=bucket_name)
|
||||
|
||||
|
@ -48,7 +47,7 @@ class GCSBucketLogger(GCSBucketBase, AdditionalLoggingUtils):
|
|||
|
||||
#### ASYNC ####
|
||||
async def async_log_success_event(self, kwargs, response_obj, start_time, end_time):
|
||||
from litellm_proxy.proxy_server import premium_user
|
||||
from litellm_proxy.proxy_server import CommonProxyErrors, premium_user
|
||||
|
||||
if premium_user is not True:
|
||||
raise ValueError(
|
||||
|
|
|
@ -21,12 +21,15 @@ from litellm.integrations.custom_logger import CustomLogger
|
|||
from litellm.types.integrations.prometheus import *
|
||||
from litellm.types.utils import StandardLoggingPayload
|
||||
from litellm.utils import get_end_user_id_for_cost_tracking
|
||||
from litellm_proxy._types import LiteLLM_TeamTable, UserAPIKeyAuth
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
||||
|
||||
from litellm_proxy._types import LiteLLM_TeamTable, UserAPIKeyAuth
|
||||
else:
|
||||
AsyncIOScheduler = Any
|
||||
UserAPIKeyAuth = Any
|
||||
LiteLLM_TeamTable = Any
|
||||
|
||||
|
||||
class PrometheusLogger(CustomLogger):
|
||||
|
@ -1511,6 +1514,8 @@ class PrometheusLogger(CustomLogger):
|
|||
self, keys: List[Union[str, UserAPIKeyAuth]]
|
||||
):
|
||||
"""Helper function to set budget metrics for a list of keys"""
|
||||
from litellm_proxy._types import UserAPIKeyAuth
|
||||
|
||||
for key in keys:
|
||||
if isinstance(key, UserAPIKeyAuth):
|
||||
self._set_key_budget_metrics(key)
|
||||
|
|
|
@ -15,7 +15,7 @@ import re
|
|||
from typing import Any, Dict, Optional
|
||||
|
||||
import litellm
|
||||
from litellm_proxy._types import KeyManagementSystem
|
||||
from litellm.types.utils import KeyManagementSystem
|
||||
|
||||
|
||||
def validate_environment():
|
||||
|
|
|
@ -27,7 +27,7 @@ from litellm.llms.custom_httpx.http_handler import (
|
|||
get_async_httpx_client,
|
||||
)
|
||||
from litellm.types.llms.custom_http import httpxSpecialProvider
|
||||
from litellm_proxy._types import KeyManagementSystem
|
||||
from litellm.types.utils import KeyManagementSystem
|
||||
|
||||
from .base_secret_manager import BaseSecretManager
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import os
|
|||
from typing import Optional
|
||||
|
||||
import litellm
|
||||
from litellm_proxy._types import KeyManagementSystem
|
||||
from litellm.types.utils import KeyManagementSystem
|
||||
|
||||
|
||||
def validate_environment():
|
||||
|
|
|
@ -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, KeyManagementSystem
|
||||
from litellm.types.utils import KeyManagementSystem
|
||||
|
||||
|
||||
class GoogleSecretManager(GCSBucketBase):
|
||||
|
@ -22,7 +22,7 @@ class GoogleSecretManager(GCSBucketBase):
|
|||
refresh_interval (int, optional): The refresh interval in seconds. Defaults to 86400. (24 hours)
|
||||
always_read_secret_manager (bool, optional): Whether to always read from the secret manager. Defaults to False. Since we do want to cache values
|
||||
"""
|
||||
from litellm_proxy.proxy_server import premium_user
|
||||
from litellm_proxy.proxy_server import CommonProxyErrors, premium_user
|
||||
|
||||
if premium_user is not True:
|
||||
raise ValueError(
|
||||
|
|
|
@ -12,7 +12,7 @@ from litellm.llms.custom_httpx.http_handler import (
|
|||
get_async_httpx_client,
|
||||
httpxSpecialProvider,
|
||||
)
|
||||
from litellm_proxy._types import KeyManagementSystem
|
||||
from litellm.types.utils import KeyManagementSystem
|
||||
|
||||
from .base_secret_manager import BaseSecretManager
|
||||
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
from typing import Any, Dict, List, Literal, Optional, Union
|
||||
from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Union
|
||||
|
||||
from fastapi import HTTPException
|
||||
from pydantic import BaseModel, EmailStr
|
||||
|
||||
from litellm_proxy._types import LiteLLM_UserTableWithKeyCount
|
||||
if TYPE_CHECKING:
|
||||
from litellm_proxy._types import LiteLLM_UserTableWithKeyCount
|
||||
else:
|
||||
LiteLLM_UserTableWithKeyCount = Any
|
||||
|
||||
|
||||
class UserListResponse(BaseModel):
|
||||
|
|
|
@ -2321,3 +2321,41 @@ class LiteLLM_UpperboundKeyGenerateParams(LiteLLMPydanticObjectBase):
|
|||
max_parallel_requests: Optional[int] = None
|
||||
tpm_limit: Optional[int] = None
|
||||
rpm_limit: Optional[int] = None
|
||||
|
||||
|
||||
class CallInfo(LiteLLMPydanticObjectBase):
|
||||
"""Used for slack budget alerting"""
|
||||
|
||||
spend: float
|
||||
max_budget: Optional[float] = None
|
||||
soft_budget: Optional[float] = None
|
||||
token: Optional[str] = Field(default=None, description="Hashed value of that key")
|
||||
customer_id: Optional[str] = None
|
||||
user_id: Optional[str] = None
|
||||
team_id: Optional[str] = None
|
||||
team_alias: Optional[str] = None
|
||||
user_email: Optional[str] = None
|
||||
key_alias: Optional[str] = None
|
||||
projected_exceeded_date: Optional[str] = None
|
||||
projected_spend: Optional[float] = None
|
||||
|
||||
|
||||
class WebhookEvent(CallInfo):
|
||||
event: Literal[
|
||||
"budget_crossed",
|
||||
"soft_budget_crossed",
|
||||
"threshold_crossed",
|
||||
"projected_limit_exceeded",
|
||||
"key_created",
|
||||
"internal_user_created",
|
||||
"spend_tracked",
|
||||
]
|
||||
event_group: Literal["internal_user", "key", "team", "proxy", "customer"]
|
||||
event_message: str # human-readable description of event
|
||||
|
||||
|
||||
class VirtualKeyEvent(LiteLLMPydanticObjectBase):
|
||||
created_by_user_id: str
|
||||
created_by_user_role: str
|
||||
created_by_key_alias: Optional[str]
|
||||
request_kwargs: dict
|
||||
|
|
|
@ -38,6 +38,7 @@ from litellm.types.utils import (
|
|||
KeyManagementSettings, # noqa: F401
|
||||
LiteLLM_UpperboundKeyGenerateParams # noqa: F401
|
||||
)
|
||||
from litellm.types.utils import CallInfo, WebhookEvent, VirtualKeyEvent # noqa: F401
|
||||
|
||||
from .types_utils.utils import get_instance_fn, validate_custom_validate_return_type
|
||||
|
||||
|
@ -1745,37 +1746,6 @@ class TokenCountResponse(LiteLLMPydanticObjectBase):
|
|||
tokenizer_type: str
|
||||
|
||||
|
||||
class CallInfo(LiteLLMPydanticObjectBase):
|
||||
"""Used for slack budget alerting"""
|
||||
|
||||
spend: float
|
||||
max_budget: Optional[float] = None
|
||||
soft_budget: Optional[float] = None
|
||||
token: Optional[str] = Field(default=None, description="Hashed value of that key")
|
||||
customer_id: Optional[str] = None
|
||||
user_id: Optional[str] = None
|
||||
team_id: Optional[str] = None
|
||||
team_alias: Optional[str] = None
|
||||
user_email: Optional[str] = None
|
||||
key_alias: Optional[str] = None
|
||||
projected_exceeded_date: Optional[str] = None
|
||||
projected_spend: Optional[float] = None
|
||||
|
||||
|
||||
class WebhookEvent(CallInfo):
|
||||
event: Literal[
|
||||
"budget_crossed",
|
||||
"soft_budget_crossed",
|
||||
"threshold_crossed",
|
||||
"projected_limit_exceeded",
|
||||
"key_created",
|
||||
"internal_user_created",
|
||||
"spend_tracked",
|
||||
]
|
||||
event_group: Literal["internal_user", "key", "team", "proxy", "customer"]
|
||||
event_message: str # human-readable description of event
|
||||
|
||||
|
||||
class SpecialModelNames(enum.Enum):
|
||||
all_team_models = "all-team-models"
|
||||
all_proxy_models = "all-proxy-models"
|
||||
|
@ -2134,13 +2104,6 @@ class SSOUserDefinedValues(TypedDict):
|
|||
budget_duration: Optional[str]
|
||||
|
||||
|
||||
class VirtualKeyEvent(LiteLLMPydanticObjectBase):
|
||||
created_by_user_id: str
|
||||
created_by_user_role: str
|
||||
created_by_key_alias: Optional[str]
|
||||
request_kwargs: dict
|
||||
|
||||
|
||||
class CreatePassThroughEndpoint(LiteLLMPydanticObjectBase):
|
||||
path: str
|
||||
target: str
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue