The Python Risk Identification Tool for generative AI (PyRIT) is an open access automation framework to empower security professionals and machine learning engineers to proactively find risks in their generative AI systems.
This PR adds GLOBAL_MEMORY_LABELS as a .env.local environment variable that flows through to all prompts sent through an Orchestrator.
self._global_memory_labels is initialized in the constructor of the Orchestrator base class via default_values.get_non_required_value so that every orchestrator will apply those labels to all prompts saved as memory entries.
Individual orchestrator classes no longer have memory_labels as a constructor parameter.
The functionality to have custom memory labels outside of the environment variable is maintained via PromptSendingOrchestrator's send_prompts_async function and MultiTurnOrchestrator's apply_attack_async. Any labels passed in through these functions take precedence over the global ones in the case of collisions, allowing for users to specify temporary labels for any batch of prompts they send.
Testing:
Relevant docs updated accordingly (+ a new PSO example) and re-ran
Tests added for GLOBAL_MEMORY_LABELS and other relevant tests were updated and re-ran
This PR adds
GLOBAL_MEMORY_LABELS
as a.env.local
environment variable that flows through to all prompts sent through an Orchestrator.self._global_memory_labels
is initialized in the constructor of theOrchestrator
base class viadefault_values.get_non_required_value
so that every orchestrator will apply those labels to all prompts saved as memory entries.memory_labels
as a constructor parameter.PromptSendingOrchestrator
'ssend_prompts_async
function andMultiTurnOrchestrator
'sapply_attack_async
. Any labels passed in through these functions take precedence over the global ones in the case of collisions, allowing for users to specify temporary labels for any batch of prompts they send.Testing:
GLOBAL_MEMORY_LABELS
and other relevant tests were updated and re-ran