Class DecisionRequest
java.lang.Object
dev.langchain4j.model.decision.request.DecisionRequest
A request to a
DecisionModel: the input() to evaluate and the
named questions() to answer about it.
The input is one of:
- plain text:
DecisionRequest.Builder.input(String); - named fields, for example a support ticket together with the customer's plan:
DecisionRequest.Builder.inputFields(Map); - a list of contents, for example text and images:
DecisionRequest.Builder.inputContents(List); - a conversation, for example a chat between a user and an AI assistant:
DecisionRequest.Builder.inputMessages(List).
UnsupportedFeatureException.
Every question is answered against the same input, and each answer is returned under the name of its question:
DecisionRequest request = DecisionRequest.builder()
.inputFields(Map.of("ticket", "My payouts have been failing for 3 days", "plan", "enterprise"))
.question("team", ChoiceQuestion.builder()
.text("Which team should handle this ticket?")
.option("billing", "Payments, invoices, refunds")
.option("support", "Problems using the product")
.build())
.question("urgent", YesNoQuestion.builder()
.text("Does this need attention today?")
.build())
.build();
- Since:
- 1.21.0
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic DecisionRequest.Builderbuilder()booleaninthashCode()input()The input to evaluate.The questions to answer, keyed by name, in the order they were added.Creates a builder initialized with the input, the questions and the parameters of this request.toString()
-
Method Details
-
input
The input to evaluate. Itstypetells which implementation it is. -
questions
-
parameters
-
modelName
-
builder
-
toBuilder
Creates a builder initialized with the input, the questions and the parameters of this request. -
equals
-
hashCode
-
toString
-