litellm/tests/guardrails_tests
jwang-gif bb58f019a0
fix(proxy): fix zguard httpcode when block input (#31948)
* fix(zscaler_ai_guard): return 400 on guardrail block

* fix(zscaler_ai_guard): don't log error on intentional BLOCK

A BLOCK is expected guardrail behavior, not a failure. Before this
fix, raising HTTPException inside the try block caused the generic
except to log it as "Failed to apply guardrail", producing spurious
error-level noise for every normal block event.

Added except HTTPException: raise before the generic handler (matching
the existing pattern in make_zscaler_ai_guard_api_call), and a
regression test that asserts logger.error is not called on a BLOCK.

---------

Co-authored-by: yucheng-berri <yucheng@berri.ai>
2026-08-05 01:46:05 +00:00
..
conftest.py fix(tests): stabilize image-edit VCR cassettes to stop live gpt-image-1 spend (#28110) 2026-05-18 09:15:39 -07:00
test_akto_guardrails.py chore(ci): modernize model references in tests and configs (#27856) 2026-05-15 15:44:28 -07:00
test_bedrock_guardrails.py fix(guardrails/bedrock): honor disable_exception_on_block by raising ModifyResponseException (#32289) 2026-07-09 13:18:51 -07:00
test_custom_guardrail.py [Feat] Presidio Improvements - Allow adding presidio api base on UI, Test presidio on Test Key, fixes for running presidio hook (#10840) 2025-05-14 17:41:33 -07:00
test_deepkeep_guardrails.py feat: add deepkeep as custom guardrail (#33844) 2026-07-20 19:27:40 -07:00
test_dynamoai_guardrails.py chore(ci): modernize model references in tests and configs (#27856) 2026-05-15 15:44:28 -07:00
test_eu_ai_act_article5.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_eu_ai_act_french_3_scenarios.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_guardrail_load_balancing.py chore(ci): modernize model references in tests and configs (#27856) 2026-05-15 15:44:28 -07:00
test_guardrails_config.py chore(ci): modernize model references in tests and configs (#27856) 2026-05-15 15:44:28 -07:00
test_javelin_guardrails.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_lakera_v2.py chore(ci): modernize model references in tests and configs (#27856) 2026-05-15 15:44:28 -07:00
test_lasso_guardrails.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_presidio_pii.py chore(ci): modernize model references in tests and configs (#27856) 2026-05-15 15:44:28 -07:00
test_semantic_guard.py fix(guardrails): cover multi-choice output variants 2026-05-01 19:38:04 -07:00
test_sg_mas_ai_guardrails.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_sg_pdpa_guardrails.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_tracing_guardrails.py chore(ci): modernize model references in tests and configs (#27856) 2026-05-15 15:44:28 -07:00
test_zscaler_ai_guard.py fix(proxy): fix zguard httpcode when block input (#31948) 2026-08-05 01:46:05 +00:00