Enhance project configuration and structure: Added build-system requirements in pyproject.toml, updated README for installation instructions, and refactored attack classes to utilize a new create_test_case method. Introduced a plugins.yaml for component registration and removed the legacy registry initialization file.

This commit is contained in:
Liao, Jie
2025-12-18 23:36:12 +08:00
parent becb9c8624
commit 84a4d1708e
49 changed files with 1474 additions and 727 deletions
+7 -11
View File
@@ -14,7 +14,7 @@ from tqdm import tqdm
from .image_random import Image_Attacker as Image_Attacker_Random
from .text_random import Text_Attacker as Text_Attacker_Random
from .minigpt_utils import prompt_wrapper, generator
from core.unified_registry import BaseAttack
from core.base_classes import BaseAttack
from core.data_formats import TestCase
from .utils import get_perspective_score
@@ -439,14 +439,10 @@ class PBAAttack(BaseAttack):
## Joint optimization
self._optimization()
return TestCase(
test_case_id=case_id,
image_path=self.save_path,
prompt=original_prompt,
metadata={
"attack_method": "pba",
"original_prompt": original_prompt,
"jailbreak_prompt": original_prompt,
"jailbreak_image_path": self.save_path,
},
return self.create_test_case(
case_id=case_id,
jailbreak_prompt=original_prompt,
jailbreak_image_path=str(self.save_path),
original_prompt=original_prompt,
original_image_path=str(image_path),
)