Merge branch 'litellm_lakera_v2_gemini_contents' into litellm_passthrough_applied_guardrails_header

This commit is contained in:
yucheng 2026-10-31 01:52:58 -07:00
commit 4a6cba89f5
2 changed files with 5 additions and 4 deletions

View file

@ -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 ()

View file

@ -947,9 +947,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,