diff --git a/litellm/proxy/guardrails/guardrail_hooks/conduct/__init__.py b/litellm/proxy/guardrails/guardrail_hooks/conduct/__init__.py index b088fa20f33..52c2ae0db61 100644 --- a/litellm/proxy/guardrails/guardrail_hooks/conduct/__init__.py +++ b/litellm/proxy/guardrails/guardrail_hooks/conduct/__init__.py @@ -43,10 +43,7 @@ def initialize_guardrail(litellm_params: "LitellmParams", guardrail: "Guardrail" # explicit ``None`` (or ``0``) also falls through to the intended # 8-second budget (cursor[bot] finding). timeout = getattr(litellm_params, "timeout", None) or _DEFAULT_TIMEOUT_SECONDS - unreachable_fallback = ( - getattr(litellm_params, "unreachable_fallback", None) - or _DEFAULT_UNREACHABLE_FALLBACK - ) + unreachable_fallback = getattr(litellm_params, "unreachable_fallback", None) or _DEFAULT_UNREACHABLE_FALLBACK _conduct_callback: Final = ConductGuardrail( api_url=getattr(litellm_params, "api_base", None), diff --git a/litellm/proxy/guardrails/guardrail_hooks/conduct/conduct.py b/litellm/proxy/guardrails/guardrail_hooks/conduct/conduct.py index 69ea38969ff..852ecc3037c 100644 --- a/litellm/proxy/guardrails/guardrail_hooks/conduct/conduct.py +++ b/litellm/proxy/guardrails/guardrail_hooks/conduct/conduct.py @@ -73,9 +73,7 @@ class ConductGuardrail(_ParentClass): # type: ignore[valid-type,misc] # ``guard_check_response`` (tracked in the plugin repo). Advertising # only pre_call today prevents silent bypass of ``during_call`` # configurations — see veria-ai finding on BerriAI/litellm#38143. - SUPPORTED_EVENT_HOOKS: ClassVar[tuple[GuardrailEventHooks, ...]] = ( - GuardrailEventHooks.pre_call, - ) + SUPPORTED_EVENT_HOOKS: ClassVar[tuple[GuardrailEventHooks, ...]] = (GuardrailEventHooks.pre_call,) def __init__(self, *args: Any, **kwargs: Any) -> None: if _IMPORT_ERROR is not None or _BaseConductGuard is None: diff --git a/tests/test_litellm/proxy/guardrails/test_conduct_guardrail.py b/tests/test_litellm/proxy/guardrails/test_conduct_guardrail.py index 25f3def1f4c..3796a380757 100644 --- a/tests/test_litellm/proxy/guardrails/test_conduct_guardrail.py +++ b/tests/test_litellm/proxy/guardrails/test_conduct_guardrail.py @@ -127,9 +127,7 @@ def test_initialize_prefers_typed_unreachable_fallback( _FakeGuard, raising=True, ) - monkeypatch.setattr( - litellm, "logging_callback_manager", SimpleNamespace(add_litellm_callback=lambda cb: None) - ) + monkeypatch.setattr(litellm, "logging_callback_manager", SimpleNamespace(add_litellm_callback=lambda cb: None)) litellm_params = SimpleNamespace( api_base=None, @@ -168,9 +166,7 @@ def test_initialize_applies_timeout_default_when_field_is_none( "litellm.proxy.guardrails.guardrail_hooks.conduct.ConductGuardrail", _FakeGuard, ) - monkeypatch.setattr( - litellm, "logging_callback_manager", SimpleNamespace(add_litellm_callback=lambda cb: None) - ) + monkeypatch.setattr(litellm, "logging_callback_manager", SimpleNamespace(add_litellm_callback=lambda cb: None)) litellm_params = SimpleNamespace( api_base=None,