GenerateContentRequest.fromJson constructor

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

Implementation

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