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.
This commit is contained in:
Ishaan Jaffer 2026-04-23 17:23:13 -07:00
parent 99b0ccfad0
commit 0348e975dc
No known key found for this signature in database

View file

@ -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,