Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
more mypy appeasement
  • Loading branch information
MilesHolland committed Oct 25, 2024
commit 368f83b85d3f1993f2d2b3f574e3ad837417d1ee
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def _parse_content_harm_response(

# get content harm metric_value
if "label" in harm_response:
metric_value = int(harm_response["label"])
metric_value = float(harm_response["label"])
elif "valid" in harm_response:
metric_value = 0 if harm_response["valid"] else math.nan
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
T_TypedDict = TypeVar("T_TypedDict", bound=Mapping[Any, Any])


def get_harm_severity_level(harm_score: int) -> Union[str, float]:
def get_harm_severity_level(harm_score: Union[float, int]) -> Union[str, float]:
"""Generate harm severity level based on harm score.

:param harm_score: The harm score to be evaluated.
Expand Down