def print_conversations()

in pyrit/orchestrator/fuzzer_orchestrator.py [0:0]


    def print_conversations(self):
        """
        Prints the conversations of the successful jailbreaks.

        Args:
            result: The result of the fuzzer.
        """
        memory = CentralMemory.get_memory_instance()
        for conversation_id in self.prompt_target_conversation_ids:
            print(f"\nConversation ID: {conversation_id}")

            target_messages = memory.get_prompt_request_pieces(conversation_id=str(conversation_id))

            if not target_messages or len(target_messages) == 0:
                print("No conversation with the target")
                return

            for message in target_messages:
                if message.role == "user":
                    print(f"{Style.BRIGHT}{Fore.BLUE}{message.role}: {message.converted_value}")
                else:
                    print(f"{Style.NORMAL}{Fore.YELLOW}{message.role}: {message.converted_value}")

                scores = memory.get_scores_by_prompt_ids(prompt_request_response_ids=[str(message.id)])
                if scores and len(scores) > 0:
                    score = scores[0]
                    print(f"{Style.RESET_ALL}score: {score} : {score.score_rationale}")