Class SessionUpdateEvent.Session.TurnDetection
-
- All Implemented Interfaces:
public final class SessionUpdateEvent.Session.TurnDetection
Configuration for turn detection, ether Server VAD or Semantic VAD. This can be set to
null
to turn off, in which case the client must manually trigger model response. Server VAD means that the model will detect the start and end of speech based on audio volume and respond at the end of user speech. Semantic VAD is more advanced and uses a turn detection model (in conjuction with VAD) to semantically estimate whether the user has finished speaking, then dynamically sets a timeout based on this probability. For example, if user audio trails off with "uhhm", the model will score a low probability of turn end and wait longer for the user to continue speaking. This can be useful for more natural conversations, but may have a higher latency.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final class
SessionUpdateEvent.Session.TurnDetection.Builder
A builder for TurnDetection.
public final class
SessionUpdateEvent.Session.TurnDetection.Eagerness
Used only for
semantic_vad
mode. The eagerness of the model to respond.low
will wait longer for the user to continue speaking,high
will respond more quickly.auto
is the default and is equivalent tomedium
.public final class
SessionUpdateEvent.Session.TurnDetection.Type
Type of turn detection.
-
Method Summary
Modifier and Type Method Description final Optional<Boolean>
createResponse()
Whether or not to automatically generate a response when a VAD stop event occurs. final Optional<SessionUpdateEvent.Session.TurnDetection.Eagerness>
eagerness()
Used only for semantic_vad
mode.final Optional<Boolean>
interruptResponse()
Whether or not to automatically interrupt any ongoing response with output to the default conversation (i.e. final Optional<Long>
prefixPaddingMs()
Used only for server_vad
mode.final Optional<Long>
silenceDurationMs()
Used only for server_vad
mode.final Optional<Double>
threshold()
Used only for server_vad
mode.final Optional<SessionUpdateEvent.Session.TurnDetection.Type>
type()
Type of turn detection. final JsonField<Boolean>
_createResponse()
Returns the raw JSON value of createResponse. final JsonField<SessionUpdateEvent.Session.TurnDetection.Eagerness>
_eagerness()
Returns the raw JSON value of eagerness. final JsonField<Boolean>
_interruptResponse()
Returns the raw JSON value of interruptResponse. final JsonField<Long>
_prefixPaddingMs()
Returns the raw JSON value of prefixPaddingMs. final JsonField<Long>
_silenceDurationMs()
Returns the raw JSON value of silenceDurationMs. final JsonField<Double>
_threshold()
Returns the raw JSON value of threshold. final JsonField<SessionUpdateEvent.Session.TurnDetection.Type>
_type()
Returns the raw JSON value of type. final Map<String, JsonValue>
_additionalProperties()
final SessionUpdateEvent.Session.TurnDetection.Builder
toBuilder()
final SessionUpdateEvent.Session.TurnDetection
validate()
final Boolean
isValid()
Boolean
equals(Object other)
Integer
hashCode()
String
toString()
final static SessionUpdateEvent.Session.TurnDetection.Builder
builder()
Returns a mutable builder for constructing an instance of TurnDetection. -
-
Method Detail
-
createResponse
final Optional<Boolean> createResponse()
Whether or not to automatically generate a response when a VAD stop event occurs.
-
eagerness
final Optional<SessionUpdateEvent.Session.TurnDetection.Eagerness> eagerness()
Used only for
semantic_vad
mode. The eagerness of the model to respond.low
will wait longer for the user to continue speaking,high
will respond more quickly.auto
is the default and is equivalent tomedium
.
-
interruptResponse
final Optional<Boolean> interruptResponse()
Whether or not to automatically interrupt any ongoing response with output to the default conversation (i.e.
conversation
ofauto
) when a VAD start event occurs.
-
prefixPaddingMs
final Optional<Long> prefixPaddingMs()
Used only for
server_vad
mode. Amount of audio to include before the VAD detected speech (in milliseconds). Defaults to 300ms.
-
silenceDurationMs
final Optional<Long> silenceDurationMs()
Used only for
server_vad
mode. Duration of silence to detect speech stop (in milliseconds). Defaults to 500ms. With shorter values the model will respond more quickly, but may jump in on short pauses from the user.
-
threshold
final Optional<Double> threshold()
Used only for
server_vad
mode. Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A higher threshold will require louder audio to activate the model, and thus might perform better in noisy environments.
-
type
final Optional<SessionUpdateEvent.Session.TurnDetection.Type> type()
Type of turn detection.
-
_createResponse
final JsonField<Boolean> _createResponse()
Returns the raw JSON value of createResponse.
Unlike createResponse, this method doesn't throw if the JSON field has an unexpected type.
-
_eagerness
final JsonField<SessionUpdateEvent.Session.TurnDetection.Eagerness> _eagerness()
Returns the raw JSON value of eagerness.
Unlike eagerness, this method doesn't throw if the JSON field has an unexpected type.
-
_interruptResponse
final JsonField<Boolean> _interruptResponse()
Returns the raw JSON value of interruptResponse.
Unlike interruptResponse, this method doesn't throw if the JSON field has an unexpected type.
-
_prefixPaddingMs
final JsonField<Long> _prefixPaddingMs()
Returns the raw JSON value of prefixPaddingMs.
Unlike prefixPaddingMs, this method doesn't throw if the JSON field has an unexpected type.
-
_silenceDurationMs
final JsonField<Long> _silenceDurationMs()
Returns the raw JSON value of silenceDurationMs.
Unlike silenceDurationMs, this method doesn't throw if the JSON field has an unexpected type.
-
_threshold
final JsonField<Double> _threshold()
Returns the raw JSON value of threshold.
Unlike threshold, this method doesn't throw if the JSON field has an unexpected type.
-
_type
final JsonField<SessionUpdateEvent.Session.TurnDetection.Type> _type()
Returns the raw JSON value of type.
Unlike type, this method doesn't throw if the JSON field has an unexpected type.
-
_additionalProperties
final Map<String, JsonValue> _additionalProperties()
-
toBuilder
final SessionUpdateEvent.Session.TurnDetection.Builder toBuilder()
-
validate
final SessionUpdateEvent.Session.TurnDetection validate()
-
builder
final static SessionUpdateEvent.Session.TurnDetection.Builder builder()
Returns a mutable builder for constructing an instance of TurnDetection.
-
-
-
-