-
Notifications
You must be signed in to change notification settings - Fork 649
FEAT: More Informative Attack Exceptions #1318
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?
FEAT: More Informative Attack Exceptions #1318
Conversation
| If an exception occurred, the context is preserved so that exception | ||
| handlers higher in the call stack can access it for enhanced error messages. | ||
| """ |
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.
nit could maybe add the Args: explanation for variables to keep consistency with the rest of the file
| # Build the "for X" part of the message based on execution context | ||
| for_clause = fn_name | ||
| try: | ||
| from pyrit.exceptions.exception_context import get_execution_context |
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.
nit should you import this at top of file?
| message=message, | ||
| conversation_id=context.session.adversarial_chat_conversation_id, | ||
| target=self._adversarial_chat, | ||
| with with_execution_context( |
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.
nit: this naming looks a little trippy the two "with" in a row but naming is hard so not a blocker by any means
jbolor21
left a comment
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.
minor comments!
This has something that has bugged me for a while, but I hadn't thought of a good solution for it. I think the solution here is decent, and it definitely improves usability. And I don't want perfect to get in the way of good...
Old way
The exceptions take some digging and often don't help.
e.g. here is a retry for a target. Which target? You'll never know...
Now, here is an error in objective_target, not that you would know that either....
New way
It still takes wrapping critical pieces in a handler, but I think it's already quite good. And will improve as we update identifiers to be better.
Here is a new error in objective_scorer:
Here is an error in a converter
Similar errors are available for both adversarial and objective chats. Here are new retry messages which now contain the component