Skip to content

Commit

Permalink
Update evaluators_service.py
Browse files Browse the repository at this point in the history
using `is not None` checks instead of truthy checks, which is more explicit and correct for boolean values.

truthy checks fails in the case of `ground_truth_value` and `llm_app_output_value` both equal to a valid False value
  • Loading branch information
morenobonaventura authored Dec 6, 2024
1 parent a3b0517 commit cbdc0f6
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ def diff(ground_truth: Any, app_output: Any, compare_schema_only: bool) -> float
llm_app_output_value = flattened_app_output.get(key, None)

key_score = 0.0
if ground_truth_value and llm_app_output_value:
if ground_truth_value is not None and llm_app_output_value is not None:
key_score = diff(
{key: ground_truth_value},
{key: llm_app_output_value},
Expand Down

0 comments on commit cbdc0f6

Please sign in to comment.