From 7021da85d2437ac65d56fb3630fbd2b942f1701d Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Thu, 12 Feb 2026 15:31:19 -0800 Subject: [PATCH] content filter test fix --- .../litellm_content_filter/content_filter.py | 6 +----- .../code_coverage_tests/check_guardrail_apply_decorator.py | 6 ++++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/litellm/proxy/guardrails/guardrail_hooks/litellm_content_filter/content_filter.py b/litellm/proxy/guardrails/guardrail_hooks/litellm_content_filter/content_filter.py index 9d64aea8910..9b2b43c6fcb 100644 --- a/litellm/proxy/guardrails/guardrail_hooks/litellm_content_filter/content_filter.py +++ b/litellm/proxy/guardrails/guardrail_hooks/litellm_content_filter/content_filter.py @@ -29,10 +29,7 @@ from fastapi import HTTPException from litellm import Router from litellm._logging import verbose_proxy_logger -from litellm.integrations.custom_guardrail import ( - CustomGuardrail, - log_guardrail_information, -) +from litellm.integrations.custom_guardrail import CustomGuardrail from litellm.proxy._types import UserAPIKeyAuth from litellm.types.utils import ModelResponseStream @@ -1056,7 +1053,6 @@ class ContentFilterGuardrail(CustomGuardrail): masked_entity_count=masked_entity_count, ) - @log_guardrail_information async def apply_guardrail( self, inputs: "GenericGuardrailAPIInputs", diff --git a/tests/code_coverage_tests/check_guardrail_apply_decorator.py b/tests/code_coverage_tests/check_guardrail_apply_decorator.py index 18a86277aa9..523b9f5b35b 100644 --- a/tests/code_coverage_tests/check_guardrail_apply_decorator.py +++ b/tests/code_coverage_tests/check_guardrail_apply_decorator.py @@ -83,6 +83,12 @@ def test_guardrail_apply_decorator(): if python_file.name == "bedrock_guardrails.py": continue + # Skip content_filter.py - it implements its own detailed logging via + # _log_guardrail_information with detections, masked_entity_count, etc. + # Using the decorator would cause duplicate entries. + if python_file.name == "content_filter.py": + continue + results = find_apply_guardrail_methods(python_file) for class_name, line_num, has_decorator in results: