Class ChoiceQuestion
java.lang.Object
dev.langchain4j.model.decision.request.ChoiceQuestion
- All Implemented Interfaces:
Question
A question that selects exactly one option out of a named set, answered with the chosen option and the
probability of each option (see
ChoiceAnswer).
Each option has a name and, optionally, a description of when it applies. Options whose name says it all, such as
sentiments, need no description
(ChoiceQuestion.of("What is the sentiment?", List.of("positive", "negative", "neutral"))):
ChoiceQuestion team = ChoiceQuestion.builder()
.text("Which team should handle this ticket?")
.option("billing", "Payments, invoices, refunds")
.option("support", "Problems using the product. Not for questions about invoices")
.build();
- Since:
- 1.21.0
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic ChoiceQuestion.Builderbuilder()booleaninthashCode()static ChoiceQuestionCreates a choice question with the given text and options without descriptions, for options whose name says it all.static ChoiceQuestionCreates a choice question with the given text and the descriptions of the options, keyed by option name.options()The descriptions of the options, keyed by option name, in the order they were added.text()What the model should evaluate, for example "Which team should handle this ticket?".toString()
-
Method Details
-
text
-
options
-
of
Creates a choice question with the given text and the descriptions of the options, keyed by option name. -
of
Creates a choice question with the given text and options without descriptions, for options whose name says it all. -
builder
-
equals
-
hashCode
-
toString
-