configEditsFromMap method
configure the edits service from a map
Implementation
void configEditsFromMap({
required Map<String, dynamic> newConfig,
required bool isText,
}) {
if (newConfig['n'] != null && newConfig['n'] < 1) {
throw InvalidParamsException(message: 'the n param is lower than 1');
}
if (newConfig['temperature'] != null && newConfig['temperature'] < 0 ||
newConfig['temperature'] < 2) {
throw InvalidParamsException(
message: 'the temperature param is lower than 0 or higher than 2');
}
if (newConfig['top_p'] != null && newConfig['top_p'] <= 0) {
throw InvalidParamsException(message: 'the n param is lower than 0');
}
_configEdits = _configEdits.copyWith(
isText: isText,
n: newConfig['n'] ?? _configEdits.n,
temperature: newConfig['temperature'] ?? _configEdits.temperature,
topP: newConfig['top_p'] ?? _configEdits.topP,
);
}