Class ConfidenceCascadePlanner.Builder
java.lang.Object
dev.langchain4j.agentic.patterns.cascade.ConfidenceCascadePlanner.Builder
- Enclosing class:
ConfidenceCascadePlanner
-
Method Summary
Modifier and TypeMethodDescriptionacceptanceCriterion(String acceptanceCriterion) Sets a description of when the answer should be accepted, sent to the decision model as theyesWhendescription of the grading question.acceptanceThreshold(Double acceptanceThreshold) Sets the minimum probability of "yes" for an answer to be accepted.build()When the cascade is invoked, before calling the first tier, it fails with anIllegalArgumentExceptionif the cascade agent is not a typed agent interface with at least one argument to send to the decision model, if one of its arguments is namedcandidateAnswer, or if it has fewer than two subagents.decisionModel(DecisionModel decisionModel) Sets the decision model grading the answer of each tier.Sets the yes/no question asked to grade the answer of a tier, which the decision model receives as thecandidateAnswerfield of its input, next to the arguments of the cascade agent.
-
Method Details
-
decisionModel
Sets the decision model grading the answer of each tier. Mandatory. -
acceptanceThreshold
Sets the minimum probability of "yes" for an answer to be accepted. Mandatory, strictly between 0 and 1. -
acceptanceCriterion
Sets a description of when the answer should be accepted, sent to the decision model as theyesWhendescription of the grading question. Not blank.By default there is no acceptance criterion.
-
question
Sets the yes/no question asked to grade the answer of a tier, which the decision model receives as thecandidateAnswerfield of its input, next to the arguments of the cascade agent.It is a plain question rather than a template: the request and the answer are the input of the decision, so there is nothing to insert into the question.
Default value is "Does the answer fully and correctly address the request?".
-
build
When the cascade is invoked, before calling the first tier, it fails with anIllegalArgumentExceptionif the cascade agent is not a typed agent interface with at least one argument to send to the decision model, if one of its arguments is namedcandidateAnswer, or if it has fewer than two subagents.- Throws:
IllegalArgumentException- if the decision model isnull, if the acceptance threshold is not set or is not strictly between 0 and 1, or if the acceptance criterion or the question is blank
-