toJson method

  1. @override
Object toJson()
override

Implementation

@override
Object toJson() {
  return {
    if (model.isNotDefault) 'model': model,
    'contents': encodeList(contents),
    if (systemInstruction != null)
      'systemInstruction': systemInstruction!.toJson(),
    if (cachedContent.isNotDefault) 'cachedContent': cachedContent,
    if (tools.isNotDefault) 'tools': encodeList(tools),
    if (toolConfig != null) 'toolConfig': toolConfig!.toJson(),
    if (labels.isNotDefault) 'labels': labels,
    if (safetySettings.isNotDefault)
      'safetySettings': encodeList(safetySettings),
    if (generationConfig != null)
      'generationConfig': generationConfig!.toJson(),
  };
}