azure-ai-evaluation: PromptyEvaluatorBase falls back to the first digit anywhere in the judge's reply, and the threshold turns a stray digit into a wrong pass/fail (15 evaluators)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 75/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- python
- 领域
- ai, testing-qa
调研方向
该错误位于 sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/_evaluators/_common/_base_prompty_eval.py 的第196-198行。首先阅读 _do_eval 方法并理解正则表达式回退机制。编写一个测试,重现 issue 中列出的有问题的裁判回复。修复应改进正则表达式以找到预期的分数,而不是第一个数字。检查继承自 PromptyEvaluatorBase 的十五个评估器,确保修复适用于所有。运行现有测试以验证没有回归。
由索引模型根据 Issue 内容生成。
描述
sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/_evaluators/_common/_base_prompty_eval.py (HEAD 4993311), _do_eval:
- line 188 — structured path:
score = parsed_output.get("score", math.nan)✓ - lines 196-198 — fallback when the reply is not parseable JSON:
match = re.search(r"\d", llm_output) if match: score = float(match.group()) - lines 115-123 — the score is then compared to
self._threshold(default 3) to produce the boolean result.
re.search(r"\d", …) returns the first digit anywhere in the text. The prompts ask for a bare integer, but nothing enforces it, and judge models routinely add reasoning before the number.
Measured
The fallback expression executed verbatim, with the threshold applied as at lines 115-123:
reply first-digit score >= 3 ?
'5' 5.0 pass (correct)
'The answer is grounded. 5' 5.0 pass (correct)
'The answer makes 3 claims, all supported by the context. Score: 5' 3.0 pass (score wrong: judge said 5)
'2 of the statements are unsupported, so this is not grounded: 1' 2.0 fail (score wrong: judge said 1)
'Score: 4 (one minor gap)' 4.0 pass (correct)
'10 out of 10' 1.0 fail (wrong: reads "10" as 1)
'0' 0.0 fail (out of range, no check)
Rows 3 and 4 are the point: the judge's verdict is correct, the recorded score is a number lifted from its explanation, and the pass/fail derived from it can differ from what the judge concluded. There is also no range check, so 0 and 7 are accepted on a 1–5 scale, and 10 becomes 1.
Stated plainly: I ran the fallback expression rather than importing the package; it is a two-line regex and the class wrapper does not alter it.
Who inherits this
grep -rl PromptyEvaluatorBase _evaluators/ — fifteen: coherence, fluency, groundedness, intent_resolution, relevance, response_completeness, retrieval, similarity, task_adherence, task_completion, tool_call_accuracy, tool_call_success, tool_input_accuracy, tool_output_utilization, tool_selection. One base class, one fix site.
Related
The deprecated promptflow-evals carried the identical re.search(r"\d") in five evaluators; this SDK inherited it into the base class and added the threshold on top, which is what turns a wrong number into a wrong verdict.
Suggested fix
In the fallback, prefer an anchored or labelled match before a bare digit: re.fullmatch(r"\s*(\d+)\s*", llm_output) (the whole reply is the number), then re.search(r"[Ss]core\s*[:=]?\s*(\d+)", llm_output), then the last number in the reply rather than the first; validate the result against the evaluator's declared range and return math.nan (which the aggregation already skips) with the raw reply in the reason field when it fails. One parametrized test with rows 3 and 4 above would pin it.
Happy to open the PR.
- 主要语言
- Python
- 星标
- 5.6k
- 派生
- 3.4k
- 平均合并
- 1 天 18 小时
- 30 天内合并 PR
- 202
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Azure/azure-sdk-for-python 的其他 Issue
-
Evaluation Service Attention
难度 2/5 1-3 小时 新手友好度 84/100
Azure/azure-sdk-for-python#49190 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 90/100
Azure/azure-sdk-for-python#49183 · 1 个 reaction ·
维护者通常 1 天内回复
-
Search Service Attention
难度 2/5 1-3 小时 新手友好度 74/100
Azure/azure-sdk-for-python#48555 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
Azure.Core customer-reported feature-request needs-team-attention
难度 2/5 1-3 小时 新手友好度 76/100
Azure/azure-sdk-for-python#47186 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
Azure/azure-sdk-for-python#46697 ·
维护者通常 1 天内回复
查看 Azure/azure-sdk-for-python 的全部 Issue
相似的 Issue
-
ACK_WAITING HELP_WANTED UPDATE_CS
难度 2/5 1-3 小时 新手友好度 78/100
OWASP/CheatSheetSeries#2458 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 90/100
BasedHardware/omi#19711 ·
维护者通常 1 天内回复
-
Qwen3_5MoeModel no longer returns router_logits, breaking aux loss with output_router_logits=True未关闭
难度 2/5 1-3 小时 新手友好度 78/100
huggingface/transformers#49172 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
vllm-project/vllm-metal#885 ·
维护者通常 1 天内回复