From d215b65f5175aa2ed273749a8204d97b551ce161 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Wed, 29 Jan 2025 18:09:49 -0800 Subject: [PATCH] fix _model_custom_llm_provider_matches_wildcard_pattern --- litellm/proxy/auth/auth_checks.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/litellm/proxy/auth/auth_checks.py b/litellm/proxy/auth/auth_checks.py index d6bbf760bde..2eeb525f557 100644 --- a/litellm/proxy/auth/auth_checks.py +++ b/litellm/proxy/auth/auth_checks.py @@ -1161,7 +1161,12 @@ def _model_custom_llm_provider_matches_wildcard_pattern( - `model=claude-3-5-sonnet-20240620` - `allowed_model_pattern=anthropic/*` """ - model, custom_llm_provider, _, _ = get_llm_provider(model=model) + try: + model, custom_llm_provider, _, _ = get_llm_provider(model=model) + except Exception as e: + verbose_proxy_logger.error(f"Error getting LLM provider for model {model}: {e}") + return False + return is_model_allowed_by_pattern( model=f"{custom_llm_provider}/{model}", allowed_model_pattern=allowed_model_pattern,