Skip to content

Commit ed68ad7

Browse files
committed
fix linting
1 parent a28ac57 commit ed68ad7

File tree

6 files changed

+19
-6
lines changed

6 files changed

+19
-6
lines changed

enterprise/enterprise_hooks/google_text_moderation.py

+1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ async def async_moderation_hook(
9494
"image_generation",
9595
"moderation",
9696
"audio_transcription",
97+
"responses",
9798
],
9899
):
99100
"""

enterprise/enterprise_hooks/llama_guard.py

+1
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ async def async_moderation_hook(
107107
"image_generation",
108108
"moderation",
109109
"audio_transcription",
110+
"responses",
110111
],
111112
):
112113
"""

enterprise/enterprise_hooks/llm_guard.py

+1
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ async def async_moderation_hook(
126126
"image_generation",
127127
"moderation",
128128
"audio_transcription",
129+
"responses",
129130
],
130131
):
131132
"""

litellm/proxy/example_config_yaml/custom_guardrail.py

+1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ async def async_moderation_hook(
6666
"image_generation",
6767
"moderation",
6868
"audio_transcription",
69+
"responses",
6970
],
7071
):
7172
"""

litellm/proxy/guardrails/guardrail_hooks/aim.py

+14-6
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,22 @@ class AimGuardrailMissingSecrets(Exception):
2525

2626

2727
class AimGuardrail(CustomGuardrail):
28-
def __init__(self, api_key: Optional[str] = None, api_base: Optional[str] = None, **kwargs):
29-
self.async_handler = get_async_httpx_client(llm_provider=httpxSpecialProvider.GuardrailCallback)
28+
def __init__(
29+
self, api_key: Optional[str] = None, api_base: Optional[str] = None, **kwargs
30+
):
31+
self.async_handler = get_async_httpx_client(
32+
llm_provider=httpxSpecialProvider.GuardrailCallback
33+
)
3034
self.api_key = api_key or os.environ.get("AIM_API_KEY")
3135
if not self.api_key:
3236
msg = (
3337
"Couldn't get Aim api key, either set the `AIM_API_KEY` in the environment or "
3438
"pass it as a parameter to the guardrail in the config file"
3539
)
3640
raise AimGuardrailMissingSecrets(msg)
37-
self.api_base = api_base or os.environ.get("AIM_API_BASE") or "https://api.aim.security"
41+
self.api_base = (
42+
api_base or os.environ.get("AIM_API_BASE") or "https://api.aim.security"
43+
)
3844
super().__init__(**kwargs)
3945

4046
async def async_pre_call_hook(
@@ -68,6 +74,7 @@ async def async_moderation_hook(
6874
"image_generation",
6975
"moderation",
7076
"audio_transcription",
77+
"responses",
7178
],
7279
) -> Union[Exception, str, dict, None]:
7380
verbose_proxy_logger.debug("Inside AIM Moderation Hook")
@@ -77,9 +84,10 @@ async def async_moderation_hook(
7784

7885
async def call_aim_guardrail(self, data: dict, hook: str) -> None:
7986
user_email = data.get("metadata", {}).get("headers", {}).get("x-aim-user-email")
80-
headers = {"Authorization": f"Bearer {self.api_key}", "x-aim-litellm-hook": hook} | (
81-
{"x-aim-user-email": user_email} if user_email else {}
82-
)
87+
headers = {
88+
"Authorization": f"Bearer {self.api_key}",
89+
"x-aim-litellm-hook": hook,
90+
} | ({"x-aim-user-email": user_email} if user_email else {})
8391
response = await self.async_handler.post(
8492
f"{self.api_base}/detect/openai",
8593
headers=headers,

litellm/proxy/guardrails/guardrail_hooks/custom_guardrail.py

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ async def async_moderation_hook(
7070
"image_generation",
7171
"moderation",
7272
"audio_transcription",
73+
"responses",
7374
],
7475
):
7576
"""

0 commit comments

Comments
 (0)