GeminiExample.fromJson constructor

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

Implementation

factory GeminiExample.fromJson(Map<String, dynamic> json) {
  return GeminiExample(
    model: json['model'] ?? '',
    contents: decodeListMessage(json['contents'], Content.fromJson) ?? [],
    systemInstruction: decode(json['systemInstruction'], Content.fromJson),
    cachedContent: json['cachedContent'] ?? '',
    tools: decodeListMessage(json['tools'], Tool.fromJson) ?? [],
    toolConfig: decode(json['toolConfig'], ToolConfig.fromJson),
    labels: decodeMap(json['labels']) ?? {},
    safetySettings:
        decodeListMessage(json['safetySettings'], SafetySetting.fromJson) ??
        [],
    generationConfig: decode(
      json['generationConfig'],
      GenerationConfig.fromJson,
    ),
  );
}