GenerationConfig.fromJson constructor

GenerationConfig.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory GenerationConfig.fromJson(Map<String, dynamic> json) {
  return GenerationConfig(
    candidateCount: json['candidateCount'],
    stopSequences: decodeList(json['stopSequences']) ?? [],
    maxOutputTokens: json['maxOutputTokens'],
    temperature: decodeDouble(json['temperature']),
    topP: decodeDouble(json['topP']),
    topK: json['topK'],
    seed: json['seed'],
    responseMimeType: json['responseMimeType'] ?? '',
    responseSchema: decode(json['responseSchema'], Schema.fromJson),
    responseJsonSchema: decodeCustom(
      json['_responseJsonSchema'],
      Value.fromJson,
    ),
    responseJsonSchemaOrdered: decodeCustom(
      json['responseJsonSchema'],
      Value.fromJson,
    ),
    presencePenalty: decodeDouble(json['presencePenalty']),
    frequencyPenalty: decodeDouble(json['frequencyPenalty']),
    responseLogprobs: json['responseLogprobs'],
    logprobs: json['logprobs'],
    enableEnhancedCivicAnswers: json['enableEnhancedCivicAnswers'],
    responseModalities:
        decodeListEnum(
          json['responseModalities'],
          GenerationConfig_Modality.fromJson,
        ) ??
        [],
    speechConfig: decode(json['speechConfig'], SpeechConfig.fromJson),
    thinkingConfig: decode(json['thinkingConfig'], ThinkingConfig.fromJson),
    imageConfig: decode(json['imageConfig'], ImageConfig.fromJson),
    mediaResolution: decodeEnum(
      json['mediaResolution'],
      GenerationConfig_MediaResolution.fromJson,
    ),
  );
}