Setup
# Fork and clone the repository
git clone https://github.com/your-username/GA.git
cd GA
# Install with development dependencies
pip install -e ".[dev]"Project Structure
GA/
├── docs/ # Documentation
├── src/generalanalysis/
│ ├── adversarial_candidate_generator/ # Prompt generation
│ ├── jailbreaks/ # Jailbreak methods
│ ├── boiler_room/ # Model interface
│ ├── loss/ # Loss functions
│ ├── data_utils/ # Data utilities
│ ├── utils/ # Common utilities
│ └── training/ # Training utilities
└── pyproject.toml # Package configurationWorkflow
- Create a branch:
git checkout -b feature/your-feature - Implement your changes
- Submit a pull request
Adding a New Jailbreak Method
# src/generalanalysis/jailbreaks/your_method/
from generalanalysis.jailbreaks.base import JailbreakMethod
from typing import List, Dict, Any
class YourJailbreakMethod(JailbreakMethod):
def __init__(self, **kwargs):
super().__init__(**kwargs)
# Initialize your method-specific attributes
def optimize(self, goals: List[str], **kwargs) -> Dict[str, Any]:
# Implement optimization logic
results = {}
for goal in goals:
# Your custom implementation here
generated_prompts = ["Prompt 1", "Prompt 2"]
results[goal] = generated_prompts
return results
# Register in src/generalanalysis/jailbreaks/__init__.pyAdding a New Generator
# src/generalanalysis/adversarial_candidate_generator/
from generalanalysis.adversarial_candidate_generator.base import AdversarialCandidateGenerator
from generalanalysis.jailbreaks import JailbreakMethod
from typing import List, Dict, Any
class YourGenerator(AdversarialCandidateGenerator):
def __init__(self, **kwargs):
super().__init__(**kwargs)
# Initialize your generator-specific attributes
def generate_candidates(self, jailbreak_method_instance: JailbreakMethod, **kwargs) -> List[str]:
# Implement generation logic
candidates = []
# Your custom implementation here
return candidatesCode Style
- Follow PEP 8 guidelines
- Classes:
CamelCase - Functions/methods:
snake_case - Line length: 88 characters max
- Docstrings: Google style
def function(arg1, arg2):
"""Short summary.
Args:
arg1: Description
arg2: Description
Returns:
Description of return value
"""Support
- GitHub Issues
- Contact: info@generalanalysis.com
Last updated on