fix(proxy): type the post-call gate input as a Mapping

This commit is contained in:
yucheng 2026-10-31 01:10:32 -07:00
parent 205026dbe4
commit e1f8fb6c46

View file

@ -885,10 +885,12 @@ async def _inherit_auth_guardrails(
return tuple(_GUARDRAIL_ENTRIES.validate_python(merged))
def _named_guardrail_runs_post_call(data: dict[str, object]) -> bool:
def _named_guardrail_runs_post_call(data: Mapping[str, object]) -> bool:
return any(
guardrail.default_on is not True
and guardrail.should_run_guardrail(data=data, event_type=GuardrailEventHooks.post_call)
and guardrail.should_run_guardrail( # pyright: ignore[reportUnknownMemberType] # takes the untyped request dict
data=data, event_type=GuardrailEventHooks.post_call
)
for guardrail in litellm.logging_callback_manager.get_custom_loggers_for_type(callback_type=CustomGuardrail)
if isinstance(guardrail, CustomGuardrail)
)