-
Notifications
You must be signed in to change notification settings - Fork 634
FEAT: Scenario DatasetConfiguration #1288
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
Open
rlundeen2
wants to merge
12
commits into
Azure:main
Choose a base branch
from
rlundeen2:users/rlundeen/2025_12_28_scenario_dataset
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
FEAT: Scenario DatasetConfiguration #1288
rlundeen2
wants to merge
12
commits into
Azure:main
from
rlundeen2:users/rlundeen/2025_12_28_scenario_dataset
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…_12_28_scenario_dataset
romanlutz
reviewed
Dec 30, 2025
Comment on lines
+241
to
250
| # Check for unexpected response type (e.g., API returned a string during content filter) | ||
| if not hasattr(response, "choices"): | ||
| raise PyritException( | ||
| message=f"Unexpected response type from API: {type(response).__name__}. " | ||
| f"Expected ChatCompletion object with 'choices' attribute. Response: {str(response)[:200]}" | ||
| ) | ||
|
|
||
| # Check for missing choices | ||
| if not response.choices: | ||
| raise PyritException(message="No choices returned in the completion response.") |
Contributor
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.
Suggested change
| # Check for unexpected response type (e.g., API returned a string during content filter) | |
| if not hasattr(response, "choices"): | |
| raise PyritException( | |
| message=f"Unexpected response type from API: {type(response).__name__}. " | |
| f"Expected ChatCompletion object with 'choices' attribute. Response: {str(response)[:200]}" | |
| ) | |
| # Check for missing choices | |
| if not response.choices: | |
| raise PyritException(message="No choices returned in the completion response.") | |
| # Check for missing choices | |
| if not hasattr(response, "choices") or not response.choices: | |
| raise PyritException(message="No choices returned in the completion response.") |
romanlutz
reviewed
Dec 30, 2025
| Args: | ||
| seed_groups (Optional[List[SeedGroup]]): Explicit list of SeedGroups to use. | ||
| dataset_names (Optional[List[str]]): Names of datasets to load from memory. | ||
| max_dataset_size (Optional[int]): If set, randomly samples up to this many SeedGroups. |
Contributor
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.
Maybe I've taken one too many combinatorics classes but we should probably specify whether this will be sampling with/without replacement.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces
DatasetConfigurationclass that is passed to scenarios ininitialize_asyncto address several pain points.Big available default datasets
It was tough to change the default datasets - some were too big and some too small. As an example, Foundry used harm_bench, which is too big for the default. So it would randomly select 4 by default. But how could users run against all 100? There was no way to configure this. On the flip side garak.encoding_scenario had a large dataset that took a very long time to run, but there was no way to make it small by default and still have the entire dataset available.
This change allows scenarios to be configured with a default (e.g. name=harm_bench, max=4). But users can easily configure both the dataset name or max differently.
It also helps with our end to end tests, which were taking a million years because encoding scenario had so many datasets (this pr reduces to only 3 by default)
Allows dataset params from the front end
This also allows users to specify the dataset names they want to use from pyrit_scan and pyrit_shell. Previously, users had to use the dataset defaults.
--dataset-names DATASET_NAMES [DATASET_NAMES ...]
Dataset names to load for the scenario (overrides scenario defaults)
--max-dataset-size MAX_DATASET_SIZE
Maximum number of seed groups to use (randomly samples if dataset is larger)
Deprecates Incompatible Parameters
objective, seed_prompts are now deprecated as initialization parameters for scenarios
Tests