toJson method
Converts to JSON.
type is only emitted when explicitly set. The bare /realtime/sessions
endpoint rejects unknown parameters; the /realtime/client_secrets
wrapper injects 'type': 'realtime' itself when it serializes the
embedded session.
Implementation
Map<String, dynamic> toJson() => {
if (type != null) 'type': type,
'model': model,
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,
};