From 5939dda0aa66310db8df6707f9522bb2fd641960 Mon Sep 17 00:00:00 2001 From: crp4222 <121295348+crp4222@users.noreply.github.com> Date: Mon, 5 Oct 2026 16:12:36 +0200 Subject: [PATCH] fix(guardrails): require privaite>=0.7.2 0.7.2 turns off the ONNX Runtime telemetry that older releases send from the process hosting the engine, which here is the proxy itself --- .../guardrails/guardrail_hooks/privaite/privaite.py | 2 +- .../proxy/guardrails/guardrail_hooks/test_privaite.py | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/litellm/proxy/guardrails/guardrail_hooks/privaite/privaite.py b/litellm/proxy/guardrails/guardrail_hooks/privaite/privaite.py index fdf4d251757..caacde82d2d 100644 --- a/litellm/proxy/guardrails/guardrail_hooks/privaite/privaite.py +++ b/litellm/proxy/guardrails/guardrail_hooks/privaite/privaite.py @@ -372,7 +372,7 @@ class PrivaiteGuardrail(CustomGuardrail): except ImportError as exc: # pragma: no cover raise RuntimeError( "The PrivAiTe guardrail requires the 'privaite' package. " - "Install it with: pip install 'privaite>=0.4.2'" + "Install it with: pip install 'privaite>=0.7.2'" ) from exc if self.block_entities and "block_entities" not in PIIConfig.model_fields: diff --git a/tests/unit/proxy/guardrails/guardrail_hooks/test_privaite.py b/tests/unit/proxy/guardrails/guardrail_hooks/test_privaite.py index c37cec6bbe1..5b3212b2a2c 100644 --- a/tests/unit/proxy/guardrails/guardrail_hooks/test_privaite.py +++ b/tests/unit/proxy/guardrails/guardrail_hooks/test_privaite.py @@ -293,6 +293,15 @@ def test_event_hook_always_includes_pre_and_post(): assert "pre_call" in gr3.event_hook and "post_call" in gr3.event_hook +@pytest.mark.asyncio +async def test_engine_missing_privaite_recommends_safe_minimum(monkeypatch: pytest.MonkeyPatch) -> None: + guardrail = _make_guardrail() + monkeypatch.setitem(sys.modules, "privaite.config.schema", None) + + with pytest.raises(RuntimeError, match=r"pip install 'privaite>=0\.7\.2'"): + await guardrail._engine_for(["en"]) + + @pytest.mark.asyncio async def test_engine_is_cached(): gr = _make_guardrail()