frequencyPenalty method

OpenAIBuilder frequencyPenalty(
  1. double penalty
)

Sets frequency penalty for reducing repetition (-2.0 to 2.0)

Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.

  • Negative values: Encourage repetition
  • 0.0: No penalty (default)
  • Positive values: Discourage repetition
  • Range: -2.0 to 2.0

Implementation

OpenAIBuilder frequencyPenalty(double penalty) {
  _baseBuilder.extension('frequencyPenalty', penalty);
  return this;
}