Class ConfidenceCascadePlanner.Builder

java.lang.Object
dev.langchain4j.agentic.patterns.cascade.ConfidenceCascadePlanner.Builder
Enclosing class:
ConfidenceCascadePlanner

public static final class ConfidenceCascadePlanner.Builder extends Object
  • Method Details

    • decisionModel

      public ConfidenceCascadePlanner.Builder decisionModel(DecisionModel decisionModel)
      Sets the decision model grading the answer of each tier. Mandatory.
    • acceptanceThreshold

      public ConfidenceCascadePlanner.Builder acceptanceThreshold(Double acceptanceThreshold)
      Sets the minimum probability of "yes" for an answer to be accepted. Mandatory, strictly between 0 and 1.
    • acceptanceCriterion

      public ConfidenceCascadePlanner.Builder acceptanceCriterion(String acceptanceCriterion)
      Sets a description of when the answer should be accepted, sent to the decision model as the yesWhen description of the grading question. Not blank.

      By default there is no acceptance criterion.

    • question

      public ConfidenceCascadePlanner.Builder question(String question)
      Sets the yes/no question asked to grade the answer of a tier, which the decision model receives as the candidateAnswer field 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

      public ConfidenceCascadePlanner build()
      When the cascade is invoked, before calling the first tier, it fails with an IllegalArgumentException if 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 named candidateAnswer, or if it has fewer than two subagents.
      Throws:
      IllegalArgumentException - if the decision model is null, 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