Skip to content
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

added optional param for run_attack_module in cli #239

Merged
merged 1 commit into from
Jun 10, 2024

Conversation

imda-kelvinkok
Copy link
Collaborator

@imda-kelvinkok imda-kelvinkok commented Jun 6, 2024

This PR is to add optional parameters for users to use in their attack modules. The optional parameters will be entered by the user in the CLI in the form of a dictionary, which the attack modules can take in (i.e. users may want to decide how many iterations the attack module should run before stopping, so the dictionary can have a field like "max_no_of_iteration" which the attack module will read in)

How to test:

  1. Start cli: python -m moonshot cli interactive
  2. Create a new session: new_session -h and copy the help sample codes to create a new session with a new runner (change the connector endpoint to one you can access with your API key)
  3. Inside the session, enter run_attack_module sample_attack_module "test prompt" -o "{'max_number_of_iteration': 1, 'my_optional_param': 'hello world'}"
  4. The attack module should run without any error

Copy link
Contributor

@imda-benedictlee imda-benedictlee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested Optional Param. Working as expected. Screenshot attached.

Screenshot 2024-06-10 at 5 43 16 PM

@imda-benedictlee imda-benedictlee merged commit 66383d8 into main Jun 10, 2024
@imda-lionelteo imda-lionelteo deleted the attack_module_param branch June 11, 2024 05:13
@imda-lseokmin
Copy link
Collaborator

Hello @imda-kelvinkok , please update moonshot-data to include an example how optional params can be used in your sample_attack_module.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants