Class YesNoAnswer

java.lang.Object
dev.langchain4j.model.decision.response.YesNoAnswer
All Implemented Interfaces:
DecisionAnswer

@Experimental public final class YesNoAnswer extends Object implements DecisionAnswer
The answer to a YesNoQuestion: the probability() that the answer is "yes".
Since:
1.21.0
  • Method Details

    • probability

      public double probability()
      The probability that the answer is "yes", from 0 (certainly "no") to 1 (certainly "yes").
    • isYes

      public boolean isYes(double threshold)
      Returns true if the probability of "yes" is greater than or equal to the given threshold.
    • of

      public static YesNoAnswer of(double probability)
      Creates an answer with the given probability of "yes", from 0 to 1.
    • builder

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