Fix atkgen verbose output displaying incorrect conversation turns #1542
+30
−2
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.
This PR fixes issue #200 - two bugs in the
atkgenprobe's verbose output feature that prevented users from viewing the conversation between the attack model and target model during red-teaming runs.Bug 1: Line 181 - Incorrect string indexing
challenge_text[1]only displayed the second character of the probe textchallenge_textto display the full probe textBug 2: Line 213 - Wrong variable displayed
this_attempt.prompt.turns[-1].content.textdisplayed the prompt sent to the model instead of the model's responseresponse_textto display the actual model responseHow it works
The
atkgenprobe has an existing verbose mode feature (triggered when--verbose >= 2or-vvflag) that should display conversation turns with emoji markers. These bugs prevented the feature from working correctly. The fixes ensure:Testing added
Added
test_atkgen_verbose_output()intests/probes/test_probes_atkgen.pythat:All 7 tests in
test_probes_atkgen.pypass.Verification
Steps to verify this fix works correctly:
python -m garak --target_type test.Blank --probes atkgen.Tox -vv --generations 1