diff --git a/litellm/proxy/guardrails/guardrail_helpers.py b/litellm/proxy/guardrails/guardrail_helpers.py index a57b965c8e..c351f9f762 100644 --- a/litellm/proxy/guardrails/guardrail_helpers.py +++ b/litellm/proxy/guardrails/guardrail_helpers.py @@ -1,3 +1,5 @@ +import os +import sys from typing import Dict import litellm @@ -5,6 +7,10 @@ from litellm._logging import verbose_proxy_logger from litellm.proxy.proxy_server import LiteLLM_TeamTable, UserAPIKeyAuth from litellm.types.guardrails import * +sys.path.insert( + 0, os.path.abspath("../..") +) # Adds the parent directory to the system path + def can_modify_guardrails(team_obj: Optional[LiteLLM_TeamTable]) -> bool: if team_obj is None: diff --git a/litellm/proxy/guardrails/init_guardrails.py b/litellm/proxy/guardrails/init_guardrails.py index f5ed9fee84..6938a6fc11 100644 --- a/litellm/proxy/guardrails/init_guardrails.py +++ b/litellm/proxy/guardrails/init_guardrails.py @@ -113,7 +113,9 @@ def init_guardrails_v2(all_guardrails: dict): # Init guardrail CustomLoggerClass if litellm_params["guardrail"] == "aporia": - from guardrail_hooks.aporia_ai import _ENTERPRISE_Aporia + from litellm.proxy.guardrails.guardrail_hooks.aporia_ai import ( + _ENTERPRISE_Aporia, + ) _aporia_callback = _ENTERPRISE_Aporia( api_base=litellm_params["api_base"],