mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 03:04:13 +00:00
fix(router.py): fix error message to return if pre-call-checks + allowed model region
This commit is contained in:
parent
c3293474dd
commit
5342b3dc05
1 changed files with 8 additions and 7 deletions
|
@ -3259,13 +3259,12 @@ class Router:
|
||||||
healthy_deployments.remove(deployment)
|
healthy_deployments.remove(deployment)
|
||||||
|
|
||||||
# filter pre-call checks
|
# filter pre-call checks
|
||||||
|
_allowed_model_region = (
|
||||||
|
request_kwargs.get("allowed_model_region")
|
||||||
|
if request_kwargs is not None
|
||||||
|
else None
|
||||||
|
)
|
||||||
if self.enable_pre_call_checks and messages is not None:
|
if self.enable_pre_call_checks and messages is not None:
|
||||||
_allowed_model_region = (
|
|
||||||
request_kwargs.get("allowed_model_region")
|
|
||||||
if request_kwargs is not None
|
|
||||||
else None
|
|
||||||
)
|
|
||||||
|
|
||||||
if _allowed_model_region == "eu":
|
if _allowed_model_region == "eu":
|
||||||
healthy_deployments = self._pre_call_checks(
|
healthy_deployments = self._pre_call_checks(
|
||||||
model=model,
|
model=model,
|
||||||
|
@ -3286,8 +3285,10 @@ class Router:
|
||||||
)
|
)
|
||||||
|
|
||||||
if len(healthy_deployments) == 0:
|
if len(healthy_deployments) == 0:
|
||||||
|
if _allowed_model_region is None:
|
||||||
|
_allowed_model_region = "n/a"
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
f"{RouterErrors.no_deployments_available.value}, passed model={model}"
|
f"{RouterErrors.no_deployments_available.value}, passed model={model}. Enable pre-call-checks={self.enable_pre_call_checks}, allowed_model_region={_allowed_model_region}"
|
||||||
)
|
)
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue