GenerationConfig.fromJson constructor
GenerationConfig.fromJson(
- Object? j
Implementation
factory GenerationConfig.fromJson(Object? j) {
final json = j as Map<String, Object?>;
return GenerationConfig(
candidateCount: switch (json['candidateCount']) {
null => null,
Object $1 => decodeInt($1),
},
stopSequences: switch (json['stopSequences']) {
null => [],
List<Object?> $1 => [for (final i in $1) decodeString(i)],
_ => throw const FormatException('"stopSequences" is not a list'),
},
maxOutputTokens: switch (json['maxOutputTokens']) {
null => null,
Object $1 => decodeInt($1),
},
temperature: switch (json['temperature']) {
null => null,
Object $1 => decodeDouble($1),
},
topP: switch (json['topP']) {
null => null,
Object $1 => decodeDouble($1),
},
topK: switch (json['topK']) {
null => null,
Object $1 => decodeInt($1),
},
seed: switch (json['seed']) {
null => null,
Object $1 => decodeInt($1),
},
responseMimeType: switch (json['responseMimeType']) {
null => '',
Object $1 => decodeString($1),
},
responseSchema: switch (json['responseSchema']) {
null => null,
Object $1 => Schema.fromJson($1),
},
responseJsonSchema: switch (json['_responseJsonSchema']) {
null => null,
Object $1 => Value.fromJson($1),
},
responseJsonSchemaOrdered: switch (json['responseJsonSchema']) {
null => null,
Object $1 => Value.fromJson($1),
},
presencePenalty: switch (json['presencePenalty']) {
null => null,
Object $1 => decodeDouble($1),
},
frequencyPenalty: switch (json['frequencyPenalty']) {
null => null,
Object $1 => decodeDouble($1),
},
responseLogprobs: switch (json['responseLogprobs']) {
null => null,
Object $1 => decodeBool($1),
},
logprobs: switch (json['logprobs']) {
null => null,
Object $1 => decodeInt($1),
},
enableEnhancedCivicAnswers: switch (json['enableEnhancedCivicAnswers']) {
null => null,
Object $1 => decodeBool($1),
},
responseModalities: switch (json['responseModalities']) {
null => [],
List<Object?> $1 => [
for (final i in $1) GenerationConfig_Modality.fromJson(i),
],
_ => throw const FormatException('"responseModalities" is not a list'),
},
speechConfig: switch (json['speechConfig']) {
null => null,
Object $1 => SpeechConfig.fromJson($1),
},
thinkingConfig: switch (json['thinkingConfig']) {
null => null,
Object $1 => ThinkingConfig.fromJson($1),
},
imageConfig: switch (json['imageConfig']) {
null => null,
Object $1 => ImageConfig.fromJson($1),
},
mediaResolution: switch (json['mediaResolution']) {
null => null,
Object $1 => GenerationConfig_MediaResolution.fromJson($1),
},
);
}