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

Add proxy, token refresh, and multi_endpoint features to generators #878

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .devcontainer/devcontainer.json
au70ma70n marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "Python 3",
"image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye",
"runArgs": [
"--env-file", ".env", "--gpus=all"
],
"customizations": {
"vscode": {
"extensions": [
"HashiCorp.terraform",
"GitHub.copilot",
"GitHub.copilot-chat"
]
}
},
"postCreateCommand": "pip install --upgrade pip && pip install -r requirements.txt",
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,4 @@ hitlog.*.jsonl
garak_runs/
runs/
logs/
.github/dependabot.yml
au70ma70n marked this conversation as resolved.
Show resolved Hide resolved
16 changes: 16 additions & 0 deletions garak/cli.py
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think the arguments here make sense to be top level cli entires. If exposed at this level users may expect them to apply to all plugins. Prefer options that can only be utilized by a specific plugin object be configured for that object specifically.

Copy link
Author

Choose a reason for hiding this comment

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

The arguments were added as top level options to provide the opportunity to integrate the functionality into other parts of the project, however if you'd rather they be moved into the class configuration file that's simple enough.

Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@ def main(arguments=None) -> None:
action="store_true",
help="allow skip of unknown probes, detectors, or buffs",
)
parser.add_argument(
"--proxies",
type=str,
help="allow proxy settings for rest generator",
)
parser.add_argument(
"--verify_ssl",
type=str,
help="expose SSL verification settings for rest generator",
)

## RUN
parser.add_argument(
Expand Down Expand Up @@ -135,6 +145,12 @@ def main(arguments=None) -> None:
type=str,
help="options to pass to the generator",
)
token_refresh_args = parser.add_mutually_exclusive_group()
token_refresh_args.add_argument(
"--token_refresh_config",
type=str,
help="path to JSON file containing configuration for the request that fetches a new token",
)
# probes
parser.add_argument(
"--probes",
Expand Down
1 change: 1 addition & 0 deletions garak/configurable.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def _load_config(self, config_root=_config):
if not hasattr(self, "key_env_var"):
self.key_env_var = self.ENV_VAR
self._validate_env_var()
# mark as configured, do not change as this is a one-time operation that should not be called again
au70ma70n marked this conversation as resolved.
Show resolved Hide resolved
self._instance_configured = True

def _apply_config(self, config):
Expand Down
Loading