toJson method

Map<String, Object?> toJson()

Implementation

Map<String, Object?> toJson() {
  return <String, Object?>{
    'id': id,
    'title': title,
    'rationale': rationale,
    'sessionId': sessionId,
    'toolName': toolName,
    if (toolKind != null) 'toolKind': toolKind,
    'options': options,
    if (choices.isNotEmpty)
      'choices': choices.map((choice) => choice.toJson()).toList(),
    'requestedAt': requestedAt.toUtc().toIso8601String(),
    if (metadata.isNotEmpty) 'metadata': metadata,
    if (generation > 0) 'generation': generation,
    if (generation > 0) 'contentFingerprint': contentFingerprint,
  };
}