Coverage for .venv/lib/python3.13/site-packages/litellm/proxy/guardrails/guardrail_hooks/panw_prisma_airs/__init__.py: 42%
15 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.types.guardrails import SupportedGuardrailIntegrations
5from .panw_prisma_airs import PanwPrismaAirsHandler
7if TYPE_CHECKING: 7 ↛ 8line 7 didn't jump to line 8 because the condition on line 7 was never true
8 from litellm.types.guardrails import Guardrail, LitellmParams
11def initialize_guardrail(litellm_params: "LitellmParams", guardrail: "Guardrail"):
12 import litellm
14 guardrail_name: Final = guardrail.get("guardrail_name")
16 # Note: api_key and profile_name can be None - handler will use env vars or API key's linked profile
17 if not guardrail_name:
18 raise ValueError("PANW Prisma AIRS: guardrail_name is required")
20 _panw_callback: Final = PanwPrismaAirsHandler(
21 **{
22 **litellm_params.model_dump(exclude_unset=True),
23 "guardrail_name": guardrail_name,
24 "event_hook": litellm_params.mode,
25 "default_on": litellm_params.default_on or False,
26 }
27 )
28 litellm.logging_callback_manager.add_litellm_callback(_panw_callback)
30 return _panw_callback
33guardrail_initializer_registry: Final = {
34 SupportedGuardrailIntegrations.PANW_PRISMA_AIRS.value: initialize_guardrail,
35}
38guardrail_class_registry: Final = {
39 SupportedGuardrailIntegrations.PANW_PRISMA_AIRS.value: PanwPrismaAirsHandler,
40}