feat: optionally penalize ambiguous answer relevancy verdicts - #3006
feat: optionally penalize ambiguous answer relevancy verdicts#3006Yashaswini1233 wants to merge 2 commits into
Conversation
|
@Yashaswini1233 is attempting to deploy a commit to the Confident AI Team on Vercel. A member of the Team first needs to authorize it. |
|
Note on CI: the lint check is currently failing on |
| + [ele for ele in actual_output if isinstance(ele, MLLMImage)], | ||
| ) | ||
|
|
||
| def _calculate_score(self): |
There was a problem hiding this comment.
Duplicate method definition.
This PR adds a new _calculate_score method at line 313 that only contains the empty-verdicts guard (return 1), but the original full _calculate_score is still defined below it at ~line 325. In Python, when a method is defined twice in the same class body, the second definition silently overrides the first — so this new one is unreachable dead code and will never execute.
There was a problem hiding this comment.
Thanks for catching this. I removed the duplicate _calculate_score() definition and retained the empty-verdict guard in the single complete method. All 8 targeted tests pass locally.
|
The duplicate _calculate_score() definition has been removed, leaving one complete scoring method with the empty-verdict guard intact. All 8 targeted tests pass locally. The remaining Black CI failure is on .scripts/release.py, which is unrelated to this PR. The Vercel check requires repository authorization. |
Summary
penalize_ambiguous_statementsoption toAnswerRelevancyMetric.idkverdicts are treated as irrelevant when calculating the answer relevancy score.penalize_ambiguous_statements=False.Motivation
Currently,
AnswerRelevancyMetriccounts every verdict other thannoas relevant, which means anidkverdict contributes positively to the score.This change provides an opt-in stricter scoring mode for users who want ambiguous statements to be penalized while remaining backward compatible with the existing behavior.
Addresses #1137.
Testing
Added focused tests covering:
idkscoring behavioridkscoringValidation performed locally:
black --checkpassedgit diff --checkpassed