feat(guardrails.py): return specific litellm params in /guardrails/list endpoint

support returning mode, default_on and guardrail name on `/guardrails/list` endpoint
This commit is contained in:
Krrish Dholakia 2025-02-10 17:18:51 -08:00
parent 93595826fb
commit e9a861ec32
4 changed files with 54 additions and 5 deletions

View file

@ -90,3 +90,24 @@ def test_guardrail_list_of_event_hooks():
assert not cg.should_run_guardrail(
data=data, event_type=GuardrailEventHooks.during_call
)
def test_guardrail_info_response():
from litellm.types.guardrails import GuardrailInfoResponse, LitellmParams
guardrail_info = GuardrailInfoResponse(
guardrail_name="aporia-pre-guard",
litellm_params=LitellmParams(
guardrail="aporia",
mode="pre_call",
),
guardrail_info={
"guardrail_name": "aporia-pre-guard",
"litellm_params": {
"guardrail": "aporia",
"mode": "always_on",
},
},
)
assert guardrail_info.litellm_params.default_on == False