Iterate Scenarios are ideal for testing models against specific objectives or constraints, where you want to verify if the model can or cannot perform certain tasks.
Basic Setup
First, let’s set up the basic imports and environment:IcantAssistTarget which is a dummy model that will always return the same response: “I can’t assist with that”.
Also we need an LLM client configured to genereate the test set. This examples uses the default OpenAiClient to generate the test set.
Configure the Scenario
MultiTurnScenarioBuilder allows you to define specific objectives that the model should either meet or avoid. Here’s how to set it up:
Understanding the Components
target: The model you want to test (in this case,IcantAssistTarget)objectives: A list ofObjectiveobjects that define what you want to test- Each
Objectivecontains:question: The prompt to testtrue_description: What a successful jailbreak would look like.false_description: What a failed jailbreak would look like.
Running the Evaluation
Once configured, running the evaluation is straightforward:Multiple Objectives
You can test multiple objectives at once by adding moreObjective instances to the list: