toJson method

Map<String, dynamic> toJson()

Converts to JSON.

Implementation

Map<String, dynamic> toJson() => {
  'assistant_id': assistantId,
  if (model != null) 'model': model,
  if (instructions != null) 'instructions': instructions,
  if (additionalInstructions != null)
    'additional_instructions': additionalInstructions,
  if (additionalMessages != null) 'additional_messages': additionalMessages,
  if (tools != null) 'tools': tools!.map((t) => t.toJson()).toList(),
  if (metadata != null) 'metadata': metadata,
  if (temperature != null) 'temperature': temperature,
  if (topP != null) 'top_p': topP,
  if (stream != null) 'stream': stream,
  if (maxPromptTokens != null) 'max_prompt_tokens': maxPromptTokens,
  if (maxCompletionTokens != null)
    'max_completion_tokens': maxCompletionTokens,
  if (truncationStrategy != null)
    'truncation_strategy': truncationStrategy!.toJson(),
  if (toolChoice != null) 'tool_choice': toolChoice!.toJson(),
  if (parallelToolCalls != null) 'parallel_tool_calls': parallelToolCalls,
  if (responseFormat != null) 'response_format': responseFormat!.toJson(),
};