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
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
    boolean
     
    from(double probability)
    Creates an answer with the given probability of "yes", from 0 to 1.
    int
     
    boolean
    isYes(double threshold)
    Returns true if the probability of "yes" is greater than or equal to the given threshold.
    of(double probability)
    Deprecated, for removal: This API element is subject to removal in a future version.
    use from(double) instead
    double
    The probability that the answer is "yes", from 0 (certainly "no") to 1 (certainly "yes").
     

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • 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.
    • from

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

      @Deprecated(since="1.23.0", forRemoval=true) public static YesNoAnswer of(double probability)
      Deprecated, for removal: This API element is subject to removal in a future version.
      use from(double) instead
      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