TurnDetection.fromJson constructor

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

Implementation

factory TurnDetection.fromJson(Map<String, dynamic>? j) {
  if (j == null) return const TurnDetection(type: TurnDetectionType.serverVad);
  return TurnDetection(
    type: TurnDetectionType.fromJson(j['type']),
    threshold: (j['threshold'] as num?)?.toDouble(),
    prefixPaddingMs: j['prefix_padding_ms'],
    silenceDurationMs: j['silence_duration_ms'],
    eagerness: j['eagerness'] == null ? null : Eagerness.fromJson(j['eagerness']),
    createResponse: j['create_response'],
    interruptResponse: j['interrupt_response'],
  );
}