mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-23 00:41:40 +00:00
style: ruff format on the conduct guardrail shim + tests
Lint job on #38143 flagged three files as needing reformat. No behavior change — just ruff-format's chosen line breaks and quoting.
This commit is contained in:
parent
58022daff7
commit
903a3bc588
3 changed files with 4 additions and 13 deletions
|
|
@ -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),
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue