toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() => {
      if (apiVersion != null) 'api_version': apiVersion,
      if (requestId != null) 'request_id': requestId,
      'instruction': instruction,
      if (hsi != null) 'hsi': hsi,
      if (schema != null) 'schema': schema,
      if (system != null) 'system': system,
      if (messages.isNotEmpty)
        'messages': messages.map((message) => message.toJson()).toList(),
      if (generation != null) 'generation': generation!.toJson(),
    };