litellm-mirror/tests/local_testing/test_guardrails_ai.py
2025-04-23 14:38:44 -07:00

28 lines
703 B
Python

import os
import sys
import traceback
sys.path.insert(
0, os.path.abspath("../..")
) # Adds the parent directory to the system path
import litellm
from litellm_proxy.guardrails.init_guardrails import init_guardrails_v2
def test_guardrails_ai():
litellm.set_verbose = True
litellm.guardrail_name_config_map = {}
init_guardrails_v2(
all_guardrails=[
{
"guardrail_name": "gibberish-guard",
"litellm_params": {
"guardrail": "guardrails_ai",
"guard_name": "gibberish_guard",
"mode": "post_call",
},
}
],
config_file_path="",
)