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 a description of when it applies. For options whose name says it all, such as
sentiments, the name is used as the 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 whose names say it all: each name is also used as the description.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 whose names say it all: each name is also used as the description. -
builder
-
equals
-
hashCode
-
toString
-