mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-10 03:28:53 +00:00
fix(proxy): clear 2 reportArgumentType breaches introduced by PR #29748
The basedpyright budget gate (lint check) failed with `reportArgumentType: 2149/2114 (+2)` because two new arg-type errors slipped in: 1. **proxy_server.py — `non_admin_all_models`**: I added an `if user_row is not None:` block to capture the user's `models` list, but the existing `_check_if_model_is_team_model( user_row=user_row, ...)` call was left OUTSIDE the block. Once basedpyright sees the `is not None` narrowing, it surfaces the widened `Any | None` type on the call site (which previously only triggered the suppressed `reportAny`). Move the `_check_if_model_is_team_model` call INSIDE the narrowed block — correct semantically too, since that helper requires a non-None user_row. 2. **utils.py — `_apply_user_models_filter` / `apply_user_models_filter_to_deployments`**: Both functions declared `user_api_key_cache: Optional["DualCache"]`, but the downstream `get_user_object(user_api_key_cache=...)` call expects `UserApiKeyCache` (the `DualCache` subclass). Tighten the annotation to `Optional["UserApiKeyCache"]`. The actual cache instance passed in at the call site is already a `UserApiKeyCache`, so this is a purely-annotation tightening with no runtime change. Verified: - basedpyright `reportArgumentType` per-file count: utils.py 7→7, proxy_server.py 62→62 (combined 69, ≤ baseline 2114). - 25/25 `test_model_checks.py` + 62/62 `tests/test_litellm/proxy/ discovery_endpoints/` all pass on this fix. Co-authored-by: songkuan-zheng <252822057+songkuan-zheng@users.noreply.github.com> Co-authored-by: songkuan-zheng <songkuan-zheng@users.noreply.github.com>
This commit is contained in:
parent
4ddfd0f0ea
commit
7cc81f0fd3
2 changed files with 7 additions and 7 deletions
|
|
@ -11483,11 +11483,11 @@ async def non_admin_all_models(
|
|||
# correctly downstream.
|
||||
user_models = list(user_row.models or [])
|
||||
|
||||
# Get all models that are team models, when model team_id == user_row.teams
|
||||
all_models += _check_if_model_is_team_model(
|
||||
models=llm_router.get_model_list() or [],
|
||||
user_row=user_row,
|
||||
)
|
||||
# Get all models that are team models, when model team_id == user_row.teams
|
||||
all_models += _check_if_model_is_team_model(
|
||||
models=llm_router.get_model_list() or [],
|
||||
user_row=user_row,
|
||||
)
|
||||
|
||||
# de-duplicate models. Only return unique model ids
|
||||
unique_models = _deduplicate_litellm_router_models(models=all_models)
|
||||
|
|
|
|||
|
|
@ -6459,7 +6459,7 @@ async def _apply_user_models_filter(
|
|||
model_access_groups: dict[str, list[str]],
|
||||
prisma_client: Optional["PrismaClient"],
|
||||
proxy_logging_obj: Optional["ProxyLogging"],
|
||||
user_api_key_cache: Optional["DualCache"],
|
||||
user_api_key_cache: Optional["UserApiKeyCache"],
|
||||
user_models_override: list[str] | None = None,
|
||||
) -> list[str]:
|
||||
"""
|
||||
|
|
@ -6554,7 +6554,7 @@ async def apply_user_models_filter_to_deployments(
|
|||
llm_router: Optional["Router"],
|
||||
prisma_client: Optional["PrismaClient"],
|
||||
proxy_logging_obj: Optional["ProxyLogging"],
|
||||
user_api_key_cache: Optional["DualCache"],
|
||||
user_api_key_cache: Optional["UserApiKeyCache"],
|
||||
user_models_override: list[str] | None = None,
|
||||
) -> list[dict[str, Any]]:
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue