Record Class ScenarioSeed

java.lang.Object
java.lang.Record
dev.dokimos.core.conversation.ScenarioSeed
Record Components:
scenario - the scenario description passed to the simulator and stored in metadata
initialMessage - the first user message, or empty to let the simulated user open
expectedOutcome - a natural-language completion criterion stored in the example metadata under "expectedOutcome", or null; it never stops the simulation
userTurns - the scripted user turns, in order; empty for a persona-driven seed
personaFactory - builds the simulated user from the generator's judge, or null for a scripted seed
maxTurns - the turn limit for this seed, or null to inherit the generator's default
expectedOutputs - expected outputs merged into the example, overriding generated defaults
metadata - extra metadata merged into the example

public record ScenarioSeed(String scenario, String initialMessage, String expectedOutcome, List<String> userTurns, Function<JudgeLM,SimulatedUser> personaFactory, Integer maxTurns, Map<String,Object> expectedOutputs, Map<String,Object> metadata) extends Record
Describes one conversation for GoldenGenerator to synthesize into a dataset example.

A seed is either scripted (a fixed list of user turns, no LLM involved) or persona-driven (a factory that receives the generator's JudgeLM and returns a SimulatedUser), never both and never neither. The factory is applied at generation time, so a method reference such as UserPersonas::confusedUser works without a judge in scope.

Turn semantics: ConversationSimulator consumes initialMessage as turn 0 and only then starts asking the simulated user for messages. A scripted seed that sets both initialMessage and userTurns therefore continues at userTurns.get(1) on the next turn, and userTurns.get(0) is never sent. Leave initialMessage empty (as scripted(String, List) does) to have the script drive every turn.

Example usage:


 ScenarioSeed refund = ScenarioSeed.scripted(
         "Return request", List.of("I want a refund", "Order #123"));

 ScenarioSeed escalation = ScenarioSeed.builder()
         .scenario("Angry customer escalates")
         .initialMessage("This product broke on day one!")
         .personaFactory(UserPersonas::aggressiveCustomer)
         .expectedOutcome("The agent apologizes and offers a replacement or refund")
         .build();
 
  • Constructor Details

  • Method Details

    • scripted

      public static ScenarioSeed scripted(String scenario, List<String> userTurns)
      Creates a scripted seed whose user turns are replayed verbatim, with no judge involved.
      Parameters:
      scenario - the scenario description
      userTurns - the user turns, in order, starting with the opening message
      Returns:
      a new scripted seed
    • persona

      public static ScenarioSeed persona(String scenario, String initialMessage, Function<JudgeLM,SimulatedUser> personaFactory)
      Creates a persona-driven seed. The factory is applied to the generator's judge at generation time, not when the seed is built.
      Parameters:
      scenario - the scenario description
      initialMessage - the first user message, or empty to let the persona open
      personaFactory - builds the simulated user from a judge
      Returns:
      a new persona-driven seed
    • builder

      public static ScenarioSeed.Builder builder()
      Creates a new builder for constructing seeds.
      Returns:
      a new builder
    • isDynamic

      public boolean isDynamic()
      Returns whether this seed drives its user with a persona factory rather than a script.
      Returns:
      true if the seed is persona-driven
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • scenario

      public String scenario()
      Returns the value of the scenario record component.
      Returns:
      the value of the scenario record component
    • initialMessage

      public String initialMessage()
      Returns the value of the initialMessage record component.
      Returns:
      the value of the initialMessage record component
    • expectedOutcome

      public String expectedOutcome()
      Returns the value of the expectedOutcome record component.
      Returns:
      the value of the expectedOutcome record component
    • userTurns

      public List<String> userTurns()
      Returns the value of the userTurns record component.
      Returns:
      the value of the userTurns record component
    • personaFactory

      public Function<JudgeLM,SimulatedUser> personaFactory()
      Returns the value of the personaFactory record component.
      Returns:
      the value of the personaFactory record component
    • maxTurns

      public Integer maxTurns()
      Returns the value of the maxTurns record component.
      Returns:
      the value of the maxTurns record component
    • expectedOutputs

      public Map<String,Object> expectedOutputs()
      Returns the value of the expectedOutputs record component.
      Returns:
      the value of the expectedOutputs record component
    • metadata

      public Map<String,Object> metadata()
      Returns the value of the metadata record component.
      Returns:
      the value of the metadata record component