Add files via upload
This commit is contained in:
parent
0978bb2f1d
commit
1284bb346b
238 changed files with 13931 additions and 3 deletions
26
easyjailbreak/seed/seed_base.py
Normal file
26
easyjailbreak/seed/seed_base.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
from typing import List
|
||||
|
||||
|
||||
class SeedBase:
|
||||
r"""
|
||||
A base class that can store and generate attack seeds.
|
||||
"""
|
||||
def __init__(self, seeds: List[str] = None):
|
||||
r"""
|
||||
Initialize a SeedBase instance with a seed list that can be empty.
|
||||
:param ~List[str] seeds: Strings that contain the context for jailbreak queries.
|
||||
"""
|
||||
if seeds is None:
|
||||
seeds = []
|
||||
self.seeds = seeds
|
||||
|
||||
def __iter__(self):
|
||||
return self.seeds.__iter__()
|
||||
|
||||
def new_seeds(self, **kwargs):
|
||||
r"""
|
||||
Generate new seeds, replacing the old batch.
|
||||
:param kwargs: Possible keywords for the generation process.
|
||||
:return: new_seeds
|
||||
"""
|
||||
raise NotImplementedError
|
||||
Loading…
Add table
Add a link
Reference in a new issue