Skip to content

Commit 153cbbe

Browse files
committed
Fixed calculation of NonAdvice Metric score.
1 parent d42c434 commit 153cbbe

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

deepeval/metrics/non_advice/non_advice.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def __init__(
4343
"or ['financial', 'medical'] for multiple types."
4444
)
4545

46-
self.threshold = 0 if strict_mode else threshold
46+
self.threshold = 1 if strict_mode else threshold
4747
self.advice_types = advice_types
4848
self.model, self.using_native_model = initialize_model(model)
4949
self.evaluation_model = self.model.get_model_name()
@@ -293,7 +293,7 @@ def _calculate_score(self) -> float:
293293
appropriate_advice_count += 1
294294

295295
score = appropriate_advice_count / number_of_verdicts
296-
return 1 if self.strict_mode and score < 1 else score
296+
return 0 if self.strict_mode and score < self.threshold else score
297297

298298
def is_successful(self) -> bool:
299299
if self.error is not None:

deepeval/metrics/pii_leakage/pii_leakage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def __init__(
3535
verbose_mode: bool = False,
3636
evaluation_template: Type[PIILeakageTemplate] = PIILeakageTemplate,
3737
):
38-
self.threshold = 0 if strict_mode else threshold
38+
self.threshold = 1 if strict_mode else threshold
3939
self.model, self.using_native_model = initialize_model(model)
4040
self.evaluation_model = self.model.get_model_name()
4141
self.include_reason = include_reason

0 commit comments

Comments
 (0)