|
55 | 55 | logger = logging.getLogger(__name__) |
56 | 56 |
|
57 | 57 |
|
58 | | -class BaselinePolicy(Enum): |
| 58 | +class BaselineAttackPolicy(Enum): |
59 | 59 | """ |
60 | 60 | Declares how a scenario type treats the default baseline atomic attack. |
61 | 61 |
|
62 | 62 | The baseline is a plain ``PromptSendingAttack`` that sends each objective unmodified, |
63 | 63 | used as a comparison point against the scenario's strategies. Each scenario class |
64 | | - declares its policy via ``Scenario.BASELINE_POLICY``; callers can still override |
| 64 | + declares its policy via ``Scenario.BASELINE_ATTACK_POLICY``; callers can still override |
65 | 65 | at runtime via ``initialize_async(include_baseline=...)`` for the ``Enabled`` and |
66 | 66 | ``Disabled`` states. |
67 | 67 | """ |
@@ -145,7 +145,7 @@ class Scenario(ABC): |
145 | 145 | #: ``initialize_async`` and overridable per run via ``include_baseline`` for the |
146 | 146 | #: ``Enabled`` and ``Disabled`` states; ``Forbidden`` is a hard constraint and a |
147 | 147 | #: caller-supplied ``include_baseline=True`` raises ``ValueError``. |
148 | | - BASELINE_POLICY: ClassVar[BaselinePolicy] = BaselinePolicy.Enabled |
| 148 | + BASELINE_ATTACK_POLICY: ClassVar[BaselineAttackPolicy] = BaselineAttackPolicy.Enabled |
149 | 149 |
|
150 | 150 | @classmethod |
151 | 151 | def _get_additional_scoring_questions(cls) -> Sequence[Path]: |
@@ -621,14 +621,14 @@ async def initialize_async( |
621 | 621 | include_baseline (bool | None): Whether to prepend a baseline atomic attack that sends |
622 | 622 | all objectives without modifications, allowing comparison between unmodified prompts |
623 | 623 | and the scenario's strategies. If None (the default), the scenario type's |
624 | | - ``BASELINE_POLICY`` class attribute decides: ``Enabled`` includes it, |
| 624 | + ``BASELINE_ATTACK_POLICY`` class attribute decides: ``Enabled`` includes it, |
625 | 625 | ``Disabled`` omits it, and ``Forbidden`` always omits it (and rejects an |
626 | | - explicit ``True``). Passing ``True`` to a scenario whose ``BASELINE_POLICY`` |
| 626 | + explicit ``True``). Passing ``True`` to a scenario whose ``BASELINE_ATTACK_POLICY`` |
627 | 627 | is ``Forbidden`` raises ``ValueError``. |
628 | 628 |
|
629 | 629 | Raises: |
630 | 630 | ValueError: If no objective_target is provided, or if ``include_baseline=True`` is passed |
631 | | - to a scenario whose ``BASELINE_POLICY`` is ``Forbidden``. |
| 631 | + to a scenario whose ``BASELINE_ATTACK_POLICY`` is ``Forbidden``. |
632 | 632 | """ |
633 | 633 | # Validate required parameters |
634 | 634 | if objective_target is None: |
@@ -657,15 +657,15 @@ async def initialize_async( |
657 | 657 | # scenario type never silently inherits a True default; explicit-True on a forbidden |
658 | 658 | # type is a hard error rather than a silent ignore. For the Enabled / Disabled states, |
659 | 659 | # a None runtime value defers to the policy. |
660 | | - if self.BASELINE_POLICY is BaselinePolicy.Forbidden: |
| 660 | + if self.BASELINE_ATTACK_POLICY is BaselineAttackPolicy.Forbidden: |
661 | 661 | if include_baseline is True: |
662 | 662 | raise ValueError( |
663 | 663 | f"{type(self).__name__} does not support a default baseline " |
664 | | - f"(BASELINE_POLICY = Forbidden); pass include_baseline=False or omit the argument." |
| 664 | + f"(BASELINE_ATTACK_POLICY = Forbidden); pass include_baseline=False or omit the argument." |
665 | 665 | ) |
666 | 666 | include_baseline = False |
667 | 667 | elif include_baseline is None: |
668 | | - include_baseline = self.BASELINE_POLICY is BaselinePolicy.Enabled |
| 668 | + include_baseline = self.BASELINE_ATTACK_POLICY is BaselineAttackPolicy.Enabled |
669 | 669 |
|
670 | 670 | self._include_baseline = include_baseline |
671 | 671 |
|
|
0 commit comments