diff --git a/parea/schemas/log.py b/parea/schemas/log.py index 8cb693e0..e6ae58f4 100644 --- a/parea/schemas/log.py +++ b/parea/schemas/log.py @@ -1,5 +1,6 @@ from typing import Any, Dict, List, Optional, Union +import math from enum import Enum from attrs import define, field @@ -70,9 +71,14 @@ class Log: @define class EvaluationResult: name: str - score: float + score: float = field() reason: Optional[str] = None + @score.validator + def _check_score_is_finite(self, attribute, value): + if not math.isfinite(value): + raise ValueError(f"Score must be finite, got {value}") + @define class EvaluatedLog(Log): diff --git a/pyproject.toml b/pyproject.toml index 03e6b5b5..a3b84d80 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "parea-ai" packages = [{ include = "parea" }] -version = "0.2.163" +version = "0.2.164" description = "Parea python sdk" readme = "README.md" authors = ["joel-parea-ai "]