From f3003a98401de220932af3826852c6e725041f95 Mon Sep 17 00:00:00 2001 From: Julio Quinteros Pro Date: Thu, 19 Feb 2026 12:24:14 -0300 Subject: [PATCH] fix(types): fix mypy errors in pass-through endpoint query param types - passthrough/utils.py: change `request_query_params` from `Dict` to `Mapping` so callers passing `dict[str, str]` satisfy the type checker (dict is invariant; Mapping is covariant in its value type) - pass_through_endpoints.py: cast `param_default_query_params` to `Optional[dict]` consistent with the existing cast pattern for other params extracted from the untyped `target_params` dict Co-Authored-By: Claude Sonnet 4.6 --- litellm/passthrough/utils.py | 4 ++-- .../proxy/pass_through_endpoints/pass_through_endpoints.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/litellm/passthrough/utils.py b/litellm/passthrough/utils.py index 74af02e5e62..fe1ecad96c2 100644 --- a/litellm/passthrough/utils.py +++ b/litellm/passthrough/utils.py @@ -1,4 +1,4 @@ -from typing import Dict, List, Optional, Union +from typing import Dict, List, Mapping, Optional, Union from urllib.parse import parse_qs import httpx @@ -10,7 +10,7 @@ class BasePassthroughUtils: @staticmethod def get_merged_query_parameters( existing_url: httpx.URL, - request_query_params: Dict[str, Union[str, list]], + request_query_params: Mapping[str, Union[str, list]], default_query_params: Optional[Dict[str, Union[str, list]]] = None ) -> Dict[str, Union[str, List[str]]]: # Get the existing query params from the target URL diff --git a/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py b/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py index 883e90f8fef..d1c4b8b3403 100644 --- a/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py +++ b/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py @@ -1221,7 +1221,7 @@ def create_pass_through_route( forward_headers=cast(Optional[bool], param_forward_headers), merge_query_params=cast(Optional[bool], param_merge_query_params), query_params=final_query_params, - default_query_params=param_default_query_params, + default_query_params=cast(Optional[dict], param_default_query_params), stream=is_streaming_request or stream, custom_body=final_custom_body, cost_per_request=cast(Optional[float], param_cost_per_request),