toJson method
Converts to JSON.
Implementation
Map<String, dynamic> toJson() => {
'id': id,
'object': object,
'created_at': createdAt,
'thread_id': threadId,
'assistant_id': assistantId,
'status': status.toJson(),
if (requiredAction != null) 'required_action': requiredAction!.toJson(),
if (lastError != null) 'last_error': lastError!.toJson(),
if (expiresAt != null) 'expires_at': expiresAt,
if (startedAt != null) 'started_at': startedAt,
if (cancelledAt != null) 'cancelled_at': cancelledAt,
if (failedAt != null) 'failed_at': failedAt,
if (completedAt != null) 'completed_at': completedAt,
if (incompleteDetails != null)
'incomplete_details': incompleteDetails!.toJson(),
'model': model,
if (instructions != null) 'instructions': instructions,
'tools': tools.map((t) => t.toJson()).toList(),
'metadata': metadata,
if (usage != null) 'usage': usage!.toJson(),
if (temperature != null) 'temperature': temperature,
if (topP != null) 'top_p': topP,
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(),
};