FIX: preserve rationale-less float scores - #2886
Open
Barry (barry166) wants to merge 1 commit into
Open
Barry (barry166) wants to merge 1 commit into
Barry (barry166) wants to merge 1 commit into
Conversation
Roman Lutz (romanlutz)
requested changes
Sep 28, 2026
| # Only include scores with non-empty rationales | ||
| rationale_parts = [format_score_for_rationale(s) for s in scores if s.score_rationale] | ||
| rationale_parts = [format_score_for_rationale(s) for s in scores] | ||
| rationale = "\n".join(rationale_parts) if rationale_parts else "" |
Contributor
There was a problem hiding this comment.
The new lines still don't identify which Azure harm category produced each value. For example, rationale-less AzureContentFilterScorer scores for Hate=0.2 and Violence=0.8 produce AzureContentFilterScorer 0.2: and AzureContentFilterScorer 0.8:. The aggregate lists both categories, but cannot tell a reader which category caused the 0.8 MAX or a threshold verdict. Could we include each score's category in its line (ideally in the shared formatter) and test this multi-category case? That would make the newly preserved entries useful for tracing the result.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #2880.
Float-scale aggregate rationales now include every constituent score, including scores without a rationale. This keeps the output consistent with the true/false and undetermined aggregation paths and preserves which scores contributed to the result.
Tests and Documentation
uv run --offline pytest -q tests/unit/score/test_float_scale_score_aggregator.py(39 passed)uv run --offline ruff check pyrit/score/float_scale/float_scale_score_aggregator.py tests/unit/score/test_float_scale_score_aggregator.pygit diff --check