Class ScaleQuestion

java.lang.Object
dev.langchain4j.model.decision.request.ScaleQuestion
All Implemented Interfaces:
Question

@Experimental public final class ScaleQuestion extends Object implements Question
A question that places the input on an ordered scale, answered with the mean level and the probability of each level (see ScaleAnswer).

Levels are described with text and ordered from lowest to highest; a level's number is its index, starting at 0:

ScaleQuestion frustration = ScaleQuestion.builder()
        .text("How frustrated is the customer?")
        .level("Calm")        // 0
        .level("Frustrated")  // 1
        .level("Angry", "Uses insults or threatens to cancel")  // 2
        .build();
A level can have a description of when it applies, in addition to its label.
Since:
1.21.0
  • Method Details

    • text

      public String text()
      Description copied from interface: Question
      What the model should evaluate, for example "Which team should handle this ticket?".
      Specified by:
      text in interface Question
    • levels

      public List<String> levels()
      The levels, from lowest (index 0) to highest.
    • levelDescriptions

      public List<String> levelDescriptions()
      The descriptions of the levels, in the same order as levels(): the description of when a level applies, or null for a level without description.
      Since:
      1.22.0
    • of

      public static ScaleQuestion of(String text, List<String> levels)
      Creates a scale question with the given text and levels, ordered from lowest to highest.
    • builder

      public static ScaleQuestion.Builder builder()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object