toJson method
Implementation
@override
Object toJson() => {
'model': model,
if (prompt case final prompt?) 'prompt': prompt.toJson(),
if (temperature case final temperature?)
'temperature': encodeDouble(temperature),
if (candidateCount case final candidateCount?)
'candidateCount': candidateCount,
if (maxOutputTokens case final maxOutputTokens?)
'maxOutputTokens': maxOutputTokens,
if (topP case final topP?) 'topP': encodeDouble(topP),
if (topK case final topK?) 'topK': topK,
if (safetySettings.isNotDefault)
'safetySettings': [for (final i in safetySettings) i.toJson()],
if (stopSequences.isNotDefault) 'stopSequences': stopSequences,
};