mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-15 23:31:29 +00:00
fix(llm_as_a_judge): set guardrail_status=guardrail_intervened when score fails, regardless of on_failure mode
This commit is contained in:
parent
bdc087d84b
commit
138bcc8051
1 changed files with 11 additions and 10 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue