Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

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)

Open Beginner friendly
#49,153 1 comment 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

@wasim-builds is already working on this.

Since Oct 4, 2026.

  • #49348 by @wasim-builds — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
75/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
ai, testing-qa

Research direction

The bug is in sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/_evaluators/_common/_base_prompty_eval.py at lines 196-198. Start by reading the _do_eval method and understanding the regex fallback. Write a test that reproduces the problematic judge replies listed in the issue. The fix should improve the regex to find the intended score, not the first digit. Check the fifteen evaluators that inherit from PromptyEvaluatorBase to ensure the fix applies to all. Run existing tests to verify no regression.

Written by the indexing model from the issue text.

Description

Evaluation Service Attention

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.

Dominant language
Python
Stars
5.6k
Forks
3.4k
Avg merge
2d 6h
Merged PRs (30d)
212

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Azure/azure-sdk-for-python

All issues in Azure/azure-sdk-for-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.