From 0348e975dcd8d15df09eae2534951372f5840306 Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Thu, 23 Apr 2026 17:23:13 -0700 Subject: [PATCH] fix(llm_as_a_judge): remove @log_guardrail_information decorator to fix duplicate guardrail_information entries The decorator and the manual finally block both called add_standard_logging_guardrail_information_to_request_data, producing two entries per request. The decorator also misclassified HTTPException(422) blocks as guardrail_failed_to_respond (it checks for 400). The finally block correctly tracks status throughout, so removing the decorator is sufficient. --- .../guardrails/guardrail_hooks/llm_as_a_judge/__init__.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/litellm/proxy/guardrails/guardrail_hooks/llm_as_a_judge/__init__.py b/litellm/proxy/guardrails/guardrail_hooks/llm_as_a_judge/__init__.py index 0a7abdbf5d2..24207a6d37d 100644 --- a/litellm/proxy/guardrails/guardrail_hooks/llm_as_a_judge/__init__.py +++ b/litellm/proxy/guardrails/guardrail_hooks/llm_as_a_judge/__init__.py @@ -8,10 +8,7 @@ import litellm from fastapi import HTTPException from litellm._logging import verbose_logger -from litellm.integrations.custom_guardrail import ( - CustomGuardrail, - log_guardrail_information, -) +from litellm.integrations.custom_guardrail import CustomGuardrail from litellm.types.guardrails import GuardrailEventHooks from litellm.types.utils import GenericGuardrailAPIInputs, GuardrailStatus @@ -151,7 +148,6 @@ class LLMAsAJudgeGuardrail(CustomGuardrail): raw = response.choices[0].message.content or "{}" # type: ignore[union-attr] return json.loads(raw) - @log_guardrail_information async def apply_guardrail( self, inputs: GenericGuardrailAPIInputs,