Skip to content

Preserve explicit passed when handling _result/_label keys#46836

Open
m7md7sien wants to merge 6 commits into
mainfrom
mohessie/fix_overwriting_passed_bug
Open

Preserve explicit passed when handling _result/_label keys#46836
m7md7sien wants to merge 6 commits into
mainfrom
mohessie/fix_overwriting_passed_bug

Conversation

@m7md7sien
Copy link
Copy Markdown
Contributor

@m7md7sien m7md7sien commented May 11, 2026

Description

In _update_metric_value, the _result/result/_label branch unconditionally derived passed from the label value for azure_ai_evaluator criteria, overwriting any passed already set by an earlier metric_key == "passed" iteration.

Guard the derivation with "passed" not in metric_dict so an explicitly provided passed value is preserved.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

In `_update_metric_value`, the `_result`/`result`/`_label` branch
unconditionally derived `passed` from the label value for
`azure_ai_evaluator` criteria, overwriting any `passed` already set by
an earlier `metric_key == "passed"` iteration.

Guard the derivation with `"passed" not in metric_dict` so an
explicitly provided `passed` value is preserved.
@github-actions github-actions Bot added the Evaluation Issues related to the client library for Azure AI Evaluation label May 11, 2026
@ela-ine
Copy link
Copy Markdown
Contributor

ela-ine commented May 12, 2026

add unit tests

@m7md7sien m7md7sien marked this pull request as ready for review May 21, 2026 01:06
Copilot AI review requested due to automatic review settings May 21, 2026 01:06
@m7md7sien m7md7sien requested a review from a team as a code owner May 21, 2026 01:06
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a metrics-parsing edge case in azure-ai-evaluation where _update_metric_value could overwrite an explicitly provided passed value while processing *_result / result / *_label keys for azure_ai_evaluator criteria.

Changes:

  • Guard passed derivation in _update_metric_value with "passed" not in metric_dict to preserve an explicitly supplied passed.
  • Add unit tests (plus small helper coverage through _extract_metric_values and _process_criteria_metrics) to ensure explicit passed is preserved and derivation still occurs when absent.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/_evaluate/_evaluate.py Prevents label-based passed derivation from overwriting an existing passed value for azure_ai_evaluator.
sdk/evaluation/azure-ai-evaluation/tests/unittests/test_evaluate.py Adds regression tests covering preservation of explicit passed and expected derivation behavior when passed is not provided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Evaluation Issues related to the client library for Azure AI Evaluation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants