RealtimeSession.fromJson constructor

RealtimeSession.fromJson(
  1. Map<String, dynamic> j
)

Implementation

factory RealtimeSession.fromJson(Map<String, dynamic> j) => RealtimeSession(
      id: j['id'],
      model: j["model"] == null ? null : RealtimeModel.fromJson(j['model']),
      outputModalities:
          j["output_modalities"] == null ? null : (j['output_modalities'] as List).map((m) => Modality.fromJson(m)).toList(),
      audio: j["audio"] == null ? null : RealtimeSessionAudio.fromJson(j['audio']),
      instructions: j['instructions'],
      tools: j["tools"] == null ? null : (j['tools'] as List).cast<Map<String, dynamic>>().map(RealtimeFunctionTool.fromJson).toList(),
      toolChoice: j["tool_choice"] == null
          ? null
          : j['tool_choice'] == null
              ? null
              : ToolChoice.fromJson(j['tool_choice']),
      temperature: j["temperature"] == null ? null : (j['temperature'] as num?)?.toDouble(),
      maxOutputTokens: j["max_output_tokens"] == null ? null : j['max_output_tokens'],
      tracing: j['tracing'] == null ? null : Tracing.fromJson(j['tracing']),
      truncation: j['truncation'] == null ? null : RealtimeTruncation.fromJson(j['truncation']),
      prompt: j['prompt'] == null ? null : Prompt.fromJson(j['prompt']),
    );