GenerateTextRequest.fromJson constructor
GenerateTextRequest.fromJson(
- Object? j
Implementation
factory GenerateTextRequest.fromJson(Object? j) {
final json = j as Map<String, Object?>;
return GenerateTextRequest(
model: switch (json['model']) {
null => '',
Object $1 => decodeString($1),
},
prompt: switch (json['prompt']) {
null => null,
Object $1 => TextPrompt.fromJson($1),
},
temperature: switch (json['temperature']) {
null => null,
Object $1 => decodeDouble($1),
},
candidateCount: switch (json['candidateCount']) {
null => null,
Object $1 => decodeInt($1),
},
maxOutputTokens: switch (json['maxOutputTokens']) {
null => null,
Object $1 => decodeInt($1),
},
topP: switch (json['topP']) {
null => null,
Object $1 => decodeDouble($1),
},
topK: switch (json['topK']) {
null => null,
Object $1 => decodeInt($1),
},
safetySettings: switch (json['safetySettings']) {
null => [],
List<Object?> $1 => [for (final i in $1) SafetySetting.fromJson(i)],
_ => throw const FormatException('"safetySettings" is not a list'),
},
stopSequences: switch (json['stopSequences']) {
null => [],
List<Object?> $1 => [for (final i in $1) decodeString(i)],
_ => throw const FormatException('"stopSequences" is not a list'),
},
);
}