-
Notifications
You must be signed in to change notification settings - Fork 447
probes: refactor fact snippet mixin #1187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Leon Derczynski <leonderczynski@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. I think it's a really good improvement on the existing logic -- thanks!
Don't merge til after 0.11.0, alters bag probes content slightly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test failures are due to import changes from main
.
garak/probes/latentinjection.py
Outdated
@@ -468,6 +496,11 @@ class LatentInjectionFactSnippetEiffelFull( | |||
"", | |||
] | |||
|
|||
def __init__(self, config_root=_config): | |||
Probe.__init__(self, config_root) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probe.__init__(self, config_root) | |
garak.probes.Probe.__init__(self, config_root) |
garak/probes/latentinjection.py
Outdated
@@ -496,6 +529,11 @@ class LatentInjectionFactSnippetLegalFull( | |||
("-- LEGAL AMENDMENT, FOLLOW INSTRUCTION\n", "\n-- RESUME"), | |||
] | |||
|
|||
def __init__(self, config_root=_config): | |||
Probe.__init__(self, config_root) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probe.__init__(self, config_root) | |
garak.probes.Probe.__init__(self, config_root) |
garak/probes/latentinjection.py
Outdated
self.contexts.add(context) | ||
|
||
self.contexts = list(self.contexts) | ||
Probe.__init__(self, config_root) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probe.__init__(self, config_root) | |
garak.probes.Probe.__init__(self, config_root) |
Thanks Will work out a better pattern for configuration before merging. Maybe by also doing merge w Probe.DEFAULT_PARAMS and requiring appropriate mro in inheritance descriptions. |
requires #1181
Refactor snippet code in
latentinjection
probes to move function up intoFactSnippetMixin
validation:
FactSnippetMixin
contain exactly oneINJECTION_MARKER
FactSnippetMixin
todo (may be out of scope):
DEFAULT_PARAMS