ares.goals package

Submodules

ares.goals.attack_goal module

Base class for Attack Goal module

class ares.goals.attack_goal.AttackGoal(config: dict[str, Any])[source]

Bases: ABC

Base class to implement attack goals extraction from the desired benchmark specified in the input

DEFAULT_ORIGIN = 'local'
class Type[source]

Bases: TypedDict

Type hints for the json template below

base_path: Path
goal: str
label: str
origin: str
output_path: Path
type: str
abstractmethod run(limit: bool | None = None, first_n: int | None = None) list[dict[str, Any]][source]

Method to run extraction of attack goals from the desired source, e.g. HarmBench

static template() dict[str, Any][source]

This method returns a template for the configuration of Attack Goal module

Returns:

dictionary with default values for the configuration of Attack Goal module

static template_types() type[source]

Return Type hints

ares.goals.generic_attack_goal module

Implementation of generic, Panda-based Attack Goal

class ares.goals.generic_attack_goal.GenericAttackGoal(config: dict[str, Any])[source]

Bases: AttackGoal

Implementation of Attack Goal for loading data from a generic file

DEFAULT_GOAL = 'Behavior'
DEFAULT_LABEL = 1
DEFAULT_TARGET = 'Sure, here is'
LIMIT = 5
run(limit: bool | None = None, first_n: int | None = -1) list[dict[str, str | int]][source]

Runs seeds extractions from goals and returns a list of dictionaries containing the seeds.

Parameters:
  • limit – If True, limits the number of seeds to the first N (e.g. LIMIT). If False, returns all results. If None, behaves the same as False. Default is None.

  • first_n – The number of seeds to return if limit is True. Default is -1 (no limit).

Returns:

A list of dictionaries, where each dictionary represents a seed with label.

Example:
>>> goal = GenericAttackGoal(config=config)
>>> goal.run()
>>> gold.run(limit=True, first_n=10)
static template() dict[str, Any][source]

This method returns a template for the configuration of GenericAttackGoal module

Returns:

dictionary with default values for the configuration of GenericAttackGoal module

Module contents

ARES Core attack goals

class ares.goals.GenericAttackGoal(config: dict[str, Any])[source]

Bases: AttackGoal

Implementation of Attack Goal for loading data from a generic file

DEFAULT_GOAL = 'Behavior'
DEFAULT_LABEL = 1
DEFAULT_TARGET = 'Sure, here is'
LIMIT = 5
run(limit: bool | None = None, first_n: int | None = -1) list[dict[str, str | int]][source]

Runs seeds extractions from goals and returns a list of dictionaries containing the seeds.

Parameters:
  • limit – If True, limits the number of seeds to the first N (e.g. LIMIT). If False, returns all results. If None, behaves the same as False. Default is None.

  • first_n – The number of seeds to return if limit is True. Default is -1 (no limit).

Returns:

A list of dictionaries, where each dictionary represents a seed with label.

Example:
>>> goal = GenericAttackGoal(config=config)
>>> goal.run()
>>> gold.run(limit=True, first_n=10)
static template() dict[str, Any][source]

This method returns a template for the configuration of GenericAttackGoal module

Returns:

dictionary with default values for the configuration of GenericAttackGoal module