in pyrit/cli/scanner_config.py [0:0]
def create_orchestrators(self, prompt_converters: Optional[List[PromptConverter]] = None) -> List[Any]:
"""
Helper method to instantiate all orchestrators from the scenario configs,
injecting objective_target, adversarial_chat, scoring_target, objective_scorer, etc.
"""
# Instantiate the top-level targets
objective_target_obj = self.objective_target.create_instance()
adversarial_chat_obj = None
if self.adversarial_chat:
adversarial_chat_obj = self.adversarial_chat.create_instance()
# If there is a scoring_target or an objective_scorer:
scoring_target_obj = None
objective_scorer_obj = None
if self.scoring:
# fill_scoring_target might have already assigned it to self.scoring.scoring_target
if self.scoring.scoring_target:
scoring_target_obj = self.scoring.scoring_target.create_instance()
# create the actual scorer
objective_scorer_obj = self.scoring.create_objective_scorer(scoring_target_obj=scoring_target_obj)
# Now each scenario can create its orchestrator
orchestrators = []
for scenario in self.scenarios:
orch = scenario.create_orchestrator(
objective_target=objective_target_obj,
adversarial_chat=adversarial_chat_obj,
prompt_converters=prompt_converters,
scoring_target=scoring_target_obj,
objective_scorer=objective_scorer_obj,
)
orchestrators.append(orch)
return orchestrators