toJson method

Map<String, dynamic> toJson()

Converts to JSON.

Implementation

Map<String, dynamic> toJson() => {
  'id': id,
  'object': object,
  'type': type,
  if (model != null) 'model': model,
  if (expiresAt != null) 'expires_at': expiresAt,
  if (audio != null) 'audio': audio!.toJson(),
  if (outputModalities != null) 'output_modalities': outputModalities,
  if (instructions != null) 'instructions': instructions,
  if (tools != null) 'tools': tools!.map((t) => t.toJson()).toList(),
  if (toolChoice != null) 'tool_choice': toolChoice!.toJson(),
  if (maxOutputTokens != null) 'max_output_tokens': maxOutputTokens!.toJson(),
  if (parallelToolCalls != null) 'parallel_tool_calls': parallelToolCalls,
  if (reasoning != null) 'reasoning': reasoning!.toJson(),
  if (tracing != null) 'tracing': tracing!.toJson(),
  if (truncation != null) 'truncation': truncation!.toJson(),
  if (include != null) 'include': include,
};