mirror of
https://github.com/dongdongunique/EvoSynth.git
synced 2026-02-12 17:22:44 +00:00
✨ Refactor imports and enhance configuration
- Update all import paths from OpenRT to jailbreak_toolbox in README - Add dotenv support in basic_usage.py for environment variable loading - Remove hardcoded path dependency in basic_usage.py - Adjust temperature parameter from 0.1 to 0.0 for consistent judging - Update project structure diagram in README to reflect new naming
This commit is contained in:
@@ -133,8 +133,8 @@ Create a `.env` file with your API credentials:
|
||||
```python
|
||||
import asyncio
|
||||
import os
|
||||
from OpenRT.models.implementations.openai_model import OpenAIModel
|
||||
from OpenRT.attacks.blackbox.implementations.evosynth import EvosynthAttack, EvosynthConfig
|
||||
from jailbreak_toolbox.models.implementations.openai_model import OpenAIModel
|
||||
from jailbreak_toolbox.attacks.blackbox.implementations.evosynth import EvosynthAttack, EvosynthConfig
|
||||
from dotenv import load_dotenv
|
||||
load_dotenv()
|
||||
|
||||
@@ -207,7 +207,7 @@ EvoSynth/
|
||||
├── eval_async.py # Main entry point
|
||||
├── data/
|
||||
│ └── harmbench.csv # Evaluation dataset
|
||||
└── OpenRT/
|
||||
└── jailbreak_toolbox/
|
||||
├── core/ # Orchestration & registry
|
||||
│ ├── async_orchestrator.py
|
||||
│ └── registry.py
|
||||
|
||||
@@ -8,13 +8,11 @@ from sklearn import base
|
||||
|
||||
# Add paths for imports
|
||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
# Add jailbreak_toolbox to Python path
|
||||
jailbreak_toolbox_path = "/mnt/shared-storage-user/chenyunhao/jailbreak-agent/jailbreak_toolbox"
|
||||
from jailbreak_toolbox.models.implementations.openai_model import OpenAIModel
|
||||
from evosynth_attack import EvosynthAttack
|
||||
from evosynth.config import EvosynthConfig
|
||||
|
||||
from dotenv import load_dotenv
|
||||
load_dotenv()
|
||||
def basic_attack_example():
|
||||
"""Simple attack with explicit judge model."""
|
||||
|
||||
@@ -29,7 +27,7 @@ def basic_attack_example():
|
||||
# Initialize explicit judge model (can be different from target)
|
||||
judge_model = OpenAIModel(
|
||||
model_name="gpt-4o-mini", # Or use a different model like "gpt-4"
|
||||
temperature=0.1, # Lower temperature for consistent judging
|
||||
temperature=0.0, # Lower temperature for consistent judging
|
||||
api_key=os.getenv("OPENAI_API_KEY"),
|
||||
base_url=os.getenv("OPENAI_BASE_URL")
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user