fix use guardrail for pre call hook

This commit is contained in:
Ishaan Jaff 2024-08-23 09:34:08 -07:00
parent 6e3f27cf69
commit a8e192a868
4 changed files with 30 additions and 54 deletions

View file

@ -393,7 +393,7 @@ class ProxyLogging:
try:
for callback in litellm.callbacks:
_callback: Optional[CustomLogger] = None
_callback = None
if isinstance(callback, str):
_callback = litellm.litellm_core_utils.litellm_logging.get_custom_logger_compatible_class(
callback
@ -401,11 +401,7 @@ class ProxyLogging:
else:
_callback = callback # type: ignore
if (
_callback is not None
and isinstance(_callback, CustomGuardrail)
and "pre_call_hook" in vars(_callback.__class__)
):
if _callback is not None and isinstance(_callback, CustomGuardrail):
from litellm.types.guardrails import GuardrailEventHooks
if (