toJson method

Map<String, dynamic> toJson()

Converts to JSON.

Implementation

Map<String, dynamic> toJson() => {
  'model': model,
  'input': input.toJson(),
  if (instructions != null) 'instructions': instructions,
  if (tools != null) 'tools': tools!.map((e) => e.toJson()).toList(),
  if (toolChoice != null) 'tool_choice': toolChoice!.toJson(),
  if (previousResponseId != null) 'previous_response_id': previousResponseId,
  if (maxOutputTokens != null) 'max_output_tokens': maxOutputTokens,
  if (temperature != null) 'temperature': temperature,
  if (topP != null) 'top_p': topP,
  if (presencePenalty != null) 'presence_penalty': presencePenalty,
  if (frequencyPenalty != null) 'frequency_penalty': frequencyPenalty,
  if (stream != null) 'stream': stream,
  if (streamOptions != null) 'stream_options': streamOptions!.toJson(),
  if (reasoning != null) 'reasoning': reasoning!.toJson(),
  if (text != null) 'text': text!.toJson(),
  if (truncation != null) 'truncation': truncation!.toJson(),
  if (parallelToolCalls != null) 'parallel_tool_calls': parallelToolCalls,
  if (serviceTier != null) 'service_tier': serviceTier!.toJson(),
  if (metadata != null) 'metadata': metadata,
  if (include != null) 'include': include!.map((e) => e.toJson()).toList(),
  if (store != null) 'store': store,
  if (background != null) 'background': background,
  if (maxToolCalls != null) 'max_tool_calls': maxToolCalls,
  if (safetyIdentifier != null) 'safety_identifier': safetyIdentifier,
  if (promptCacheKey != null) 'prompt_cache_key': promptCacheKey,
  if (topLogprobs != null) 'top_logprobs': topLogprobs,
};