mirror of
https://github.com/dongdongunique/EvoSynth.git
synced 2026-02-12 17:22:44 +00:00
23 lines
639 B
Python
23 lines
639 B
Python
from abc import ABC, abstractmethod
|
|
from dataclasses import dataclass, field
|
|
from typing import Any, List, Dict
|
|
from ..models.base_model import BaseModel
|
|
|
|
@dataclass
|
|
class AttackResult:
|
|
target: Any
|
|
success: bool = False
|
|
final_prompt: str = ""
|
|
output_text: str = ""
|
|
history: List[Dict[str, Any]] = field(default_factory=list)
|
|
cost: Dict[str, float] = field(default_factory=dict)
|
|
method: str = ""
|
|
image_path: str = ""
|
|
class BaseAttack(ABC):
|
|
def __init__(self, model: BaseModel, **kwargs):
|
|
self.model = model
|
|
|
|
@abstractmethod
|
|
def attack(self, target: Any) -> AttackResult:
|
|
pass
|
|
|