Class ChoiceQuestion

java.lang.Object
org.springframework.ai.decision.question.ChoiceQuestion
All Implemented Interfaces:
DecisionQuestion

public final class ChoiceQuestion extends Object implements DecisionQuestion
A question answered by picking one of the offered options, as a ChoiceAnswer. Each option has a name and, optionally, a description that tells the model when the option applies; a blank description counts as none.
Since:
2.1.0
Author:
Thomas Vitale
  • Method Details

    • of

      public static ChoiceQuestion of(String text, String... options)
      A question whose options have no description.
    • builder

      public static ChoiceQuestion.Builder builder()
    • getText

      public String getText()
      Description copied from interface: DecisionQuestion
      The question text, which tells the model what to decide.
      Specified by:
      getText in interface DecisionQuestion
    • getOptions

      public Map<String,@Nullable String> getOptions()
      The options, name to description, in the order they were declared. A description is null when the option has none or a blank one.
    • getOptionNames

      public List<String> getOptionNames()
      The option names, in the order they were declared.
    • equals

      public boolean equals(@Nullable 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