forked from phoenix/litellm-mirror
Additional Fixes (09/17/2024) (#5759)
* fix(auth_checks.py): check if key has all model access via wildcard routing Fixes issue where key with `openai/*` couldn't call gpt models * fix(slack_alerting.py): expose flag for disabling failed spend tracking alerts
This commit is contained in:
parent
98c335acd0
commit
9c8fdee068
4 changed files with 18 additions and 16 deletions
|
@ -69,6 +69,7 @@ class SlackAlerting(CustomBatchLogger):
|
|||
"cooldown_deployment",
|
||||
"new_model_added",
|
||||
"outage_alerts",
|
||||
"failed_tracking_spend",
|
||||
],
|
||||
alert_to_webhook_url: Optional[
|
||||
Dict[AlertType, Union[List[str], str]]
|
||||
|
@ -598,6 +599,12 @@ class SlackAlerting(CustomBatchLogger):
|
|||
|
||||
async def failed_tracking_alert(self, error_message: str):
|
||||
"""Raise alert when tracking failed for specific model"""
|
||||
if self.alerting is None or self.alert_types is None:
|
||||
# do nothing if alerting is not switched on
|
||||
return
|
||||
if "failed_tracking_spend" not in self.alert_types:
|
||||
return
|
||||
|
||||
_cache: DualCache = self.internal_usage_cache
|
||||
message = "Failed Tracking Cost for " + error_message
|
||||
_cache_key = "budget_alerts:failed_tracking:{}".format(message)
|
||||
|
|
|
@ -19,16 +19,4 @@ model_list:
|
|||
- model_name: o1-preview
|
||||
litellm_params:
|
||||
model: o1-preview
|
||||
|
||||
guardrails:
|
||||
- guardrail_name: "hide-secrets"
|
||||
litellm_params:
|
||||
guardrail: "hide-secrets" # supported values: "aporia", "lakera"
|
||||
mode: "pre_call"
|
||||
# detect_secrets_config: {
|
||||
# "plugins_used": [
|
||||
# {"name": "SoftlayerDetector"},
|
||||
# {"name": "StripeDetector"},
|
||||
# {"name": "NpmDetector"}
|
||||
# ]
|
||||
# }
|
||||
|
|
@ -123,6 +123,7 @@ AlertType = Literal[
|
|||
"outage_alerts",
|
||||
"region_outage_alerts",
|
||||
"fallback_reports",
|
||||
"failed_tracking_spend",
|
||||
]
|
||||
|
||||
|
||||
|
|
|
@ -607,11 +607,17 @@ async def can_key_call_model(
|
|||
|
||||
filtered_models += models_in_current_access_groups
|
||||
verbose_proxy_logger.debug(f"model: {model}; allowed_models: {filtered_models}")
|
||||
|
||||
all_model_access: bool = False
|
||||
|
||||
if (
|
||||
model is not None
|
||||
and model not in filtered_models
|
||||
and "*" not in filtered_models
|
||||
len(filtered_models) == 0
|
||||
or "*" in filtered_models
|
||||
or "openai/*" in filtered_models
|
||||
):
|
||||
all_model_access = True
|
||||
|
||||
if model is not None and model not in filtered_models and all_model_access is False:
|
||||
raise ValueError(
|
||||
f"API Key not allowed to access model. This token can only access models={valid_token.models}. Tried to access {model}"
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue