toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() => {
      'object': 'response',
      if (background != null) 'background': background,
      if (createdAt != null) 'created_at': createdAt,
      if (error != null) 'error': error!.toJson(),
      if (id != null) 'id': id,
      if (incompleteDetails != null) 'incomplete_details': incompleteDetails!.toJson(),
      if (instructions != null) 'instructions': instructions,
      if (input != null) 'input': input!.toJson(),
      if (maxOutputTokens != null) 'max_output_tokens': maxOutputTokens,
      if (metadata != null) 'metadata': metadata,
      if (model != null) 'model': model?.toJson(),
      if (parallelToolCalls != null) 'parallel_tool_calls': parallelToolCalls,
      if (previousResponseId != null) 'previous_response_id': previousResponseId,
      if (prompt != null) 'prompt': prompt!.toJson(),
      if (reasoning != null) 'reasoning': reasoning!.toJson(),
      if (serviceTier != null) 'service_tier': serviceTier!.toJson(),
      if (status != null) 'status': status,
      if (temperature != null) 'temperature': temperature,
      if (text != null) 'text': text!.toJson(),
      if (toolChoice != null) 'tool_choice': toolChoice!.toJson(),
      if (tools != null) 'tools': tools!.map((t) => t.toJson()).toList(),
      if (topP != null) 'top_p': topP,
      if (truncation != null) 'truncation': truncation!.toJson(),
      if (usage != null) 'usage': usage!.toJson(),
      if (user != null) 'user': user,
      if (output != null) 'output': output!.map((e) => e.toJson()).toList(),
    };