fix: converge non-numeric selector scores to ValueError
This commit is contained in:
@@ -188,7 +188,11 @@ async def _score_options(
|
||||
if not isinstance(scores_raw, list) or len(scores_raw) != len(options):
|
||||
msg = f"打分数量({len(scores_raw) if isinstance(scores_raw, list) else 'NA'}) != 选项数({len(options)})"
|
||||
raise ValueError(msg)
|
||||
return [max(0.0, min(1.0, float(s))) for s in scores_raw]
|
||||
try:
|
||||
return [max(0.0, min(1.0, float(s))) for s in scores_raw]
|
||||
except (TypeError, ValueError) as e:
|
||||
msg = f"打分含非数值元素: {e}"
|
||||
raise ValueError(msg) from e
|
||||
|
||||
|
||||
async def build_grounded_options(
|
||||
|
||||
Reference in New Issue
Block a user