fix(buffs): use prompt setter in paraphrase buffs to update conversations - #2200
Merged
jmartin-tech merged 1 commit intoSep 16, 2026
Merged
Conversation
…ions and maintain Conversation type In PegasusT5.transform() and Fast.transform(), paraphrased_attempt._prompt was being assigned directly to a garak.attempt.Message object rather than using the paraphrased_attempt.prompt property setter. Directly setting the private _prompt attribute caused: 1. paraphrased_attempt.conversations was not updated, leaving the original unparaphrased prompt in conversations. 2. paraphrased_attempt.prompt returned a Message instead of a Conversation. 3. Calling paraphrased_attempt.lang raised AttributeError: 'Message' object has no attribute 'turns'. By assigning via paraphrased_attempt.prompt = ... (matching lowercase.py, encoding.py, and low_resource_languages.py), the setter creates the proper Conversation turn structure and updates conversations. Added regression tests verifying that transformed attempts have a Conversation prompt, valid lang access, and updated conversations history. Signed-off-by: bodapatisaikrishna <saikrishnabodapati@gmail.com>
jmartin-tech
approved these changes
Sep 16, 2026
jmartin-tech
left a comment
Collaborator
There was a problem hiding this comment.
Nice catch this is a clear error from the Conversation support refactor.
6 tasks done
7 tasks done
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
In
garak/buffs/paraphrase.py,PegasusT5.transform()andFast.transform()previously assigned paraphrased messages directly to the private attributeparaphrased_attempt._prompt:Directly assigning
_prompt = Message(...)bypassed theAttempt.promptproperty setter. This led to several issues:conversations: Thepromptsetter is responsible for updatingself.conversations. Bypassing it meantparaphrased_attempt.conversationswas never updated with the paraphrased text and retained the original prompt. Downstream generator executions or reports readingconversationsreceived the unparaphrased text.prompttype:Attempt.promptreturned<class 'garak.attempt.Message'>instead of<class 'garak.attempt.Conversation'>.AttributeErroronattempt.lang:Attempt.langexpectsself.promptto be aConversationand accessesself.prompt.turns[-1].content.lang. Calling.langon any attempt transformed byPegasusT5orFastraisedAttributeError: 'Message' object has no attribute 'turns'.Fix
Update both
PegasusT5.transform()andFast.transform()to use the public property setter:This matches the correct pattern used in other buffs (
garak/buffs/lowercase.py,garak/buffs/encoding.py,garak/buffs/low_resource_languages.py).Testing
test_buff_load_and_transformintests/buffs/test_buffs.pyverifying that every transformed attempt'spromptis aConversationand that.langis accessible without error.test_paraphrase_transform_conversation_and_langintests/buffs/test_buffs.py.Verification
paraphrased_attempt.promptis aConversation,.langreturns the language string, andparaphrased_attempt.conversationsreflects the new paraphrase text.