Coverage for .venv/lib/python3.13/site-packages/litellm/proxy/guardrails/guardrail_hooks/onyx/__init__.py: 57%
12 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-10 12:01 +0000
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-10 12:01 +0000
1from typing import TYPE_CHECKING, Final
3from litellm.proxy.guardrails.guardrail_hooks.onyx.onyx import OnyxGuardrail
4from litellm.types.guardrails import SupportedGuardrailIntegrations
6if TYPE_CHECKING: 6 ↛ 7line 6 didn't jump to line 7 because the condition on line 6 was never true
7 from litellm.types.guardrails import Guardrail, LitellmParams
10def initialize_guardrail(litellm_params: "LitellmParams", guardrail: "Guardrail"):
11 import litellm
13 _onyx_callback: Final = OnyxGuardrail(
14 api_base=litellm_params.api_base,
15 api_key=litellm_params.api_key,
16 guardrail_name=guardrail.get("guardrail_name", ""),
17 event_hook=litellm_params.mode,
18 default_on=litellm_params.default_on,
19 )
20 litellm.logging_callback_manager.add_litellm_callback(_onyx_callback)
22 return _onyx_callback
25guardrail_initializer_registry: Final = {
26 SupportedGuardrailIntegrations.ONYX.value: initialize_guardrail,
27}
30guardrail_class_registry: Final = {
31 SupportedGuardrailIntegrations.ONYX.value: OnyxGuardrail,
32}