Skip to content

Commit a4c376b

Browse files
Add warning for invalid score and default to 0
1 parent b6bf3d8 commit a4c376b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

detectors/llm_judge/detector.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ def _get_score(self, result: EvaluationResult) -> float:
6868
"""
6969
if isinstance(result.decision, (int, float)) or result.score is not None:
7070
return float(result.score if result.score is not None else result.decision)
71+
logger.warning(f"Score is not a number: '{result.score}'. Defaulting to 0.0")
7172
return 0.0 # FIXME: default to 0 because of non-optional field in schema
7273

7374
async def evaluate_single_content(self, content: str, params: Dict[str, Any]) -> ContentAnalysisResponse:

0 commit comments

Comments
 (0)