configEditsFromConfig method

void configEditsFromConfig({
  1. required ConfigEdits config,
})

configure the edits service from a ConfigEdits object

Implementation

void configEditsFromConfig({
  required ConfigEdits config,
}) {
  if (config.n != null && config.n! < 1) {
    throw InvalidParamsException(message: 'the n param is lower than 1');
  }
  if (config.temperature != null &&
      (config.temperature! < 0 || config.temperature! > 2)) {
    throw InvalidParamsException(
        message: 'the temperature param is lower than 0 or higher than 2');
  }
  if (config.topP != null && config.topP! <= 0) {
    throw InvalidParamsException(message: 'the n param is lower than 0');
  }
  _configEdits = _configEdits.copyWith(
    isText: config.isText,
    n: config.n,
    temperature: config.temperature,
    topP: config.topP,
  );
}