fix(llm_as_a_judge): set guardrail_status=guardrail_intervened when score fails, regardless of on_failure mode

This commit is contained in:
Ishaan Jaffer 2026-04-24 11:33:50 -07:00
parent bdc087d84b
commit 138bcc8051
No known key found for this signature in database

View file

@ -209,17 +209,18 @@ class LLMAsAJudgeGuardrail(CustomGuardrail):
else:
_metadata["eval_information"] = eval_info
if not passed and self.on_failure == "block":
if not passed:
status = "guardrail_intervened"
raise HTTPException(
status_code=422,
detail={
"error": "LLM judge rejected response: score below threshold",
"overall_score": overall_score,
"threshold": self.overall_threshold,
"verdicts": judge_result.get("verdicts", []),
},
)
if self.on_failure == "block":
raise HTTPException(
status_code=422,
detail={
"error": "LLM judge rejected response: score below threshold",
"overall_score": overall_score,
"threshold": self.overall_threshold,
"verdicts": judge_result.get("verdicts", []),
},
)
return inputs