forked from phoenix/litellm-mirror
rename Aporia Guardrail
This commit is contained in:
parent
a4f9ba4a88
commit
042350bd74
5 changed files with 12 additions and 11 deletions
|
@ -36,7 +36,7 @@ litellm.set_verbose = True
|
|||
GUARDRAIL_NAME = "aporia"
|
||||
|
||||
|
||||
class _ENTERPRISE_Aporia(CustomGuardrail):
|
||||
class AporiaGuardrail(CustomGuardrail):
|
||||
def __init__(
|
||||
self, api_key: Optional[str] = None, api_base: Optional[str] = None, **kwargs
|
||||
):
|
||||
|
|
|
@ -120,7 +120,7 @@ def initialize_callbacks_on_proxy(
|
|||
imported_list.append(lakera_moderations_object)
|
||||
elif isinstance(callback, str) and callback == "aporia_prompt_injection":
|
||||
from litellm.proxy.guardrails.guardrail_hooks.aporia_ai import (
|
||||
_ENTERPRISE_Aporia,
|
||||
AporiaGuardrail,
|
||||
)
|
||||
|
||||
if premium_user is not True:
|
||||
|
@ -129,7 +129,7 @@ def initialize_callbacks_on_proxy(
|
|||
+ CommonProxyErrors.not_premium_user.value
|
||||
)
|
||||
|
||||
aporia_guardrail_object = _ENTERPRISE_Aporia()
|
||||
aporia_guardrail_object = AporiaGuardrail()
|
||||
imported_list.append(aporia_guardrail_object)
|
||||
elif isinstance(callback, str) and callback == "google_text_moderation":
|
||||
from enterprise.enterprise_hooks.google_text_moderation import (
|
||||
|
|
|
@ -40,7 +40,7 @@ litellm.set_verbose = True
|
|||
GUARDRAIL_NAME = "aporia"
|
||||
|
||||
|
||||
class _ENTERPRISE_Aporia(CustomGuardrail):
|
||||
class AporiaGuardrail(CustomGuardrail):
|
||||
def __init__(
|
||||
self, api_key: Optional[str] = None, api_base: Optional[str] = None, **kwargs
|
||||
):
|
||||
|
|
|
@ -114,10 +114,10 @@ def init_guardrails_v2(all_guardrails: dict):
|
|||
# Init guardrail CustomLoggerClass
|
||||
if litellm_params["guardrail"] == "aporia":
|
||||
from litellm.proxy.guardrails.guardrail_hooks.aporia_ai import (
|
||||
_ENTERPRISE_Aporia,
|
||||
AporiaGuardrail,
|
||||
)
|
||||
|
||||
_aporia_callback = _ENTERPRISE_Aporia(
|
||||
_aporia_callback = AporiaGuardrail(
|
||||
api_base=litellm_params["api_base"],
|
||||
api_key=litellm_params["api_key"],
|
||||
guardrail_name=guardrail["guardrail_name"],
|
||||
|
|
|
@ -12,9 +12,10 @@ guardrails:
|
|||
mode: "post_call"
|
||||
api_key: os.environ/APORIA_API_KEY_1
|
||||
api_base: os.environ/APORIA_API_BASE_1
|
||||
- guardrail_name: "aporia-post-guard"
|
||||
- guardrail_name: "lakera-pre-guard"
|
||||
litellm_params:
|
||||
guardrail: aporia # supported values: "aporia", "bedrock", "lakera"
|
||||
mode: "post_call"
|
||||
api_key: os.environ/APORIA_API_KEY_2
|
||||
api_base: os.environ/APORIA_API_BASE_2
|
||||
guardrail: lakera # supported values: "aporia", "bedrock", "lakera"
|
||||
mode: "pre_call"
|
||||
api_key: os.environ/LAKERA_API_KEY
|
||||
api_base: os.environ/LAKERA_API_BASE
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue