Class YesNoQuestion
java.lang.Object
dev.langchain4j.model.decision.request.YesNoQuestion
- All Implemented Interfaces:
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();
They describe what "yes" and "no" mean for this question when the question alone is ambiguous. When only one of
them is set, how it combines with the question is up to the model: some models read a lone yesWhen as the
only reason to answer "yes". To split the cases clearly, set both.- Since:
- 1.21.0
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic YesNoQuestion.Builderbuilder()booleanstatic YesNoQuestionCreates a yes/no question with the given text.inthashCode()noWhen()When the answer should be "no", ornullif not set.static YesNoQuestionDeprecated, for removal: This API element is subject to removal in a future version.text()What the model should evaluate, for example "Which team should handle this ticket?".toString()yesWhen()When the answer should be "yes", ornullif not set.
-
Method Details
-
text
-
yesWhen
When the answer should be "yes", ornullif not set. -
noWhen
When the answer should be "no", ornullif not set. -
from
Creates a yes/no question with the given text.- Since:
- 1.23.0
-
of
Deprecated, for removal: This API element is subject to removal in a future version.usefrom(String)insteadCreates a yes/no question with the given text. -
builder
-
equals
-
hashCode
-
toString
-
from(String)instead