Class ScenarioSeed.Builder

java.lang.Object
dev.dokimos.core.conversation.ScenarioSeed.Builder
Enclosing class:
ScenarioSeed

public static class ScenarioSeed.Builder extends Object
Builder for constructing scenario seeds.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • scenario

      public ScenarioSeed.Builder scenario(String scenario)
      Sets the scenario description.
      Parameters:
      scenario - the scenario description
      Returns:
      this builder
    • initialMessage

      public ScenarioSeed.Builder initialMessage(String initialMessage)
      Sets the first user message.

      On a scripted seed this message replaces the first entry of userTurns, which is then never sent.

      Parameters:
      initialMessage - the first user message
      Returns:
      this builder
    • expectedOutcome

      public ScenarioSeed.Builder expectedOutcome(String expectedOutcome)
      Sets the natural-language completion criterion stored under "expectedOutcome" in the generated example's metadata, for a judge to grade the conversation against. It is never used as a stopping condition.
      Parameters:
      expectedOutcome - the expected outcome
      Returns:
      this builder
    • userTurn

      public ScenarioSeed.Builder userTurn(String turn)
      Adds one scripted user turn.
      Parameters:
      turn - the user turn content
      Returns:
      this builder
    • userTurns

      public ScenarioSeed.Builder userTurns(List<String> turns)
      Replaces the scripted user turns.
      Parameters:
      turns - the user turns, in order
      Returns:
      this builder
    • personaFactory

      public ScenarioSeed.Builder personaFactory(Function<JudgeLM,SimulatedUser> personaFactory)
      Sets the factory that builds the simulated user from the generator's judge.
      Parameters:
      personaFactory - the persona factory
      Returns:
      this builder
    • maxTurns

      public ScenarioSeed.Builder maxTurns(int maxTurns)
      Sets the turn limit for this seed, overriding the generator's default. A scripted seed stops at its last user turn regardless of the limit.
      Parameters:
      maxTurns - the maximum number of turns
      Returns:
      this builder
    • expectedOutput

      public ScenarioSeed.Builder expectedOutput(String key, Object value)
      Adds an expected output with the given key and value.
      Parameters:
      key - the output key
      value - the output value
      Returns:
      this builder
    • expectedOutputs

      public ScenarioSeed.Builder expectedOutputs(Map<String,Object> expectedOutputs)
      Adds all entries from the given expected outputs map.
      Parameters:
      expectedOutputs - the expected outputs to add
      Returns:
      this builder
    • metadata

      public ScenarioSeed.Builder metadata(String key, Object value)
      Adds metadata with the given key and value.
      Parameters:
      key - the metadata key
      value - the metadata value
      Returns:
      this builder
    • metadata

      public ScenarioSeed.Builder metadata(Map<String,Object> metadata)
      Adds all entries from the given metadata map.
      Parameters:
      metadata - the metadata to add
      Returns:
      this builder
    • build

      public ScenarioSeed build()
      Builds the scenario seed.
      Returns:
      a new scenario seed
      Throws:
      IllegalArgumentException - if neither or both of userTurns and personaFactory are set