Class YesNoQuestion

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

@Experimental public final class YesNoQuestion extends Object implements Question
A yes/no question, answered with the probability that the answer is "yes" (see YesNoAnswer).

Optionally, yesWhen() and noWhen() describe when the answer should be "yes" and when it should be "no":

YesNoQuestion refundRequested = YesNoQuestion.builder()
        .text("Does the customer ask for a refund?")
        .yesWhen("The customer explicitly asks for their money back")
        .noWhen("The customer only asks about a charge")
        .build();
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
    • yesWhen

      public String yesWhen()
      When the answer should be "yes", or null if not set.
    • noWhen

      public String noWhen()
      When the answer should be "no", or null if not set.
    • of

      public static YesNoQuestion of(String text)
      Creates a yes/no question with the given text.
    • builder

      public static YesNoQuestion.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