Class DecisionScoringModel.Builder

java.lang.Object
dev.langchain4j.model.scoring.DecisionScoringModel.Builder
Enclosing class:
DecisionScoringModel

public static class DecisionScoringModel.Builder extends Object
Since:
1.21.0
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • decisionModel

      public DecisionScoringModel.Builder decisionModel(DecisionModel decisionModel)
      Sets the decision model that scores the segments. Required.
    • questionTemplate

      public DecisionScoringModel.Builder questionTemplate(PromptTemplate questionTemplate)
      Sets the template of the yes/no question asked for each segment, which must contain the {{document}} variable (the text of the segment). The score is the probability of "yes".

      Default value is DecisionScoringModel.DEFAULT_QUESTION_TEMPLATE.

    • maxSegmentsPerRequest

      public DecisionScoringModel.Builder maxSegmentsPerRequest(Integer maxSegmentsPerRequest)
      Sets the maximum number of segments sent in a single request to the decision model, so that the segments of a request do not exceed the input size accepted by the decision model.

      Default value is 20.

    • listeners

      Sets the listeners notified before each scoring request, after each response and on each error. The listeners of the decision model are notified as well, once per request sent to it.
      Parameters:
      listeners - the listeners.
      Returns:
      this.
    • listeners

      public DecisionScoringModel.Builder listeners(ScoringModelListener... listeners)
      Sets the listeners notified before each scoring request, after each response and on each error. The listeners of the decision model are notified as well, once per request sent to it.
      Parameters:
      listeners - the listeners.
      Returns:
      this.
    • build

      public DecisionScoringModel build()