Repository navigation
FIX: join score categories in pretty score output - #3014
Open
Ayoub (Ayoubhm07) wants to merge 1 commit into
Open
Ayoub (Ayoubhm07) wants to merge 1 commit into
Ayoub (Ayoubhm07) wants to merge 1 commit into
Conversation
PrettyScorePrinter._render_score interpolated score_category into an f-string, so the Python list repr reached the operator's console as "Category: ['refusal', 'scams']". The field has been list[str] since microsoft#1104, which touched no printer and left this f-string behind. MarkdownScorePrinter, Score.__str__ and format_score_for_rationale all join it with ", " already. Apply the same line as the sibling printer in the same sub-package. PrettyScorePrinter is the default score printer for the attack-result and conversation printers, so their inline score block changes the same way. Category strings come from the scorer's LLM and, as in the markdown printer, a newline inside one is not escaped.
Author
|
@microsoft-github-policy-service agree |
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
Closes #3013
PrettyScorePrinter._render_scoreinterpolatesscore_categoryinto an f-string, so the list repr reaches the operator's console:score_categoryhas beenlist[str]since #1104, which touched no printer and left this one f-string behind. Everything else that renders it joins it with", ":MarkdownScorePrinter(markdown.py:53),Score.__str__(score.py:336),format_score_for_rationale(score_utils.py:85), and the web UI under the sameCategorylabel (frontend/src/components/Chat/MessageList.tsx:143). This applies the same line as its sibling in the same sub-package.PrettyScorePrinteris also the default score printer forPrettyAttackResultPrinter(attack_result/pretty.py:59) andPrettyConversationPrinter(conversation/pretty.py:64), so their inline score block changes the same way.Category: [currently appears 81 times across the 14 docs pages listed indoc/myst.yml; stored notebook outputs are not regenerated in this PR.Category strings come from the scorer's LLM, and as in the markdown printer a
\ninside one is not escapedescape_control_characterskeeps tabs and newlines. Happy to escape it here instead if you would rather.Tests and Documentation
Two tests in
tests/unit/output/score/test_pretty.py: one for the join, one for theN/Apath. Only the first fails onmain; theN/Aguard passes already and is there so the empty case stays covered.Windows 11, Python 3.11.9, ruff 0.16.10. No JupyText run: this PR changes no notebook and no docs file.