mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-10 22:41:41 +00:00
Merge pull request #18629 from akraines/fix/wildcard-routing-errors
fix: Improve error messages and validation for wildcard routing with multiple credentials
This commit is contained in:
commit
940138f585
1 changed files with 19 additions and 3 deletions
|
|
@ -4485,9 +4485,21 @@ class Router:
|
|||
|
||||
if hasattr(original_exception, "message"):
|
||||
# add the available fallbacks to the exception
|
||||
original_exception.message += ". Received Model Group={}\nAvailable Model Group Fallbacks={}".format( # type: ignore
|
||||
model_group,
|
||||
fallback_model_group,
|
||||
deployment_info = ""
|
||||
if kwargs is not None:
|
||||
metadata = kwargs.get('metadata', {})
|
||||
if metadata and 'deployment' in metadata:
|
||||
deployment_info = f"\nUsed Deployment: {metadata['deployment']}"
|
||||
if 'model_info' in metadata:
|
||||
model_info = metadata['model_info']
|
||||
if isinstance(model_info, dict):
|
||||
deployment_info += f"\nDeployment ID: {model_info.get('id', 'unknown')}"
|
||||
|
||||
original_exception.message += ( # type: ignore
|
||||
f". Received Model Group={model_group}"
|
||||
f"\nAvailable Model Group Fallbacks={fallback_model_group}"
|
||||
f"{deployment_info}"
|
||||
f"\n\n💡 Tip: If using wildcard patterns (e.g., 'openai/*'), ensure all matching deployments have credentials with access to this model."
|
||||
)
|
||||
if len(fallback_failure_exception_str) > 0:
|
||||
original_exception.message += ( # type: ignore
|
||||
|
|
@ -7664,6 +7676,10 @@ class Router:
|
|||
)
|
||||
|
||||
if pattern_deployments:
|
||||
verbose_router_logger.debug(
|
||||
f"Pattern match for model='{model}': Found {len(pattern_deployments)} deployments. "
|
||||
f"Deployment IDs: {[d.get('model_info', {}).get('id', 'unknown') for d in pattern_deployments]}"
|
||||
)
|
||||
return model, pattern_deployments
|
||||
|
||||
if (
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue