From 9a870cfab730b0c709ddab42f5b2a12ef79f8219 Mon Sep 17 00:00:00 2001 From: yucheng Date: Sat, 31 Oct 2026 01:51:21 -0700 Subject: [PATCH 1/2] fix(proxy): type configured pass-through guardrails as entries --- .../proxy/pass_through_endpoints/pass_through_endpoints.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py b/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py index cb37c6f30c3..8ec0a89e77d 100644 --- a/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py +++ b/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py @@ -867,9 +867,9 @@ class HttpPassThroughEndpointHelpers(BasePassthroughUtils): async def _inherit_auth_guardrails( parsed_body: dict[str, object] | None, # mutable-ok: merges the guardrails into the live request body user_api_key_dict: UserAPIKeyAuth, - configured_guardrails: Mapping[str, bool] | None, + configured_guardrails: Sequence[object] | None, inherit: bool, -) -> Mapping[str, bool] | Sequence[object] | None: +) -> Sequence[object] | None: """Return the guardrails a pass-through request runs after the provider responds. The endpoint's configured guardrails win. Without any, and with ``inherit`` and a JSON body, the key, team, From 955f43b7862add77d1b298ae1fdeccedea4ce53a Mon Sep 17 00:00:00 2001 From: yucheng Date: Sat, 31 Oct 2026 01:51:34 -0700 Subject: [PATCH 2/2] fix(guardrails): type the single Gemini item as a mapping --- litellm/proxy/guardrails/guardrail_hooks/lakera_ai_v2.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/litellm/proxy/guardrails/guardrail_hooks/lakera_ai_v2.py b/litellm/proxy/guardrails/guardrail_hooks/lakera_ai_v2.py index 456a3697219..234cac7847a 100644 --- a/litellm/proxy/guardrails/guardrail_hooks/lakera_ai_v2.py +++ b/litellm/proxy/guardrails/guardrail_hooks/lakera_ai_v2.py @@ -222,8 +222,9 @@ def _unmaskable_reason( def _gemini_items(value: object) -> Sequence[object]: """A repeated Gemini field as a sequence: a JSON array, or the single object Google also accepts in its place.""" - if isinstance(value, dict): - return (value,) + single: Final = as_str_mapping(value) + if single is not None: + return (single,) return _OBJECT_LIST.validate_python(value) if isinstance(value, list) else ()