Class RealtimeSession.TurnDetection
-
- All Implemented Interfaces:
public final class RealtimeSession.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 conjunction 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 interface
RealtimeSession.TurnDetection.Visitor
An interface that defines how to map each variant of TurnDetection to a value of type T.
public final class
RealtimeSession.TurnDetection.ServerVad
Server-side voice activity detection (VAD) which flips on when user speech is detected and off after a period of silence.
public final class
RealtimeSession.TurnDetection.SemanticVad
Server-side semantic turn detection which uses a model to determine when the user has finished speaking.
-
Method Summary
Modifier and Type Method Description final Optional<RealtimeSession.TurnDetection.ServerVad>
serverVad()
Server-side voice activity detection (VAD) which flips on when user speech is detected and off after a period of silence. final Optional<RealtimeSession.TurnDetection.SemanticVad>
semanticVad()
Server-side semantic turn detection which uses a model to determine when the user has finished speaking. final Boolean
isServerVad()
final Boolean
isSemanticVad()
final RealtimeSession.TurnDetection.ServerVad
asServerVad()
Server-side voice activity detection (VAD) which flips on when user speech is detected and off after a period of silence. final RealtimeSession.TurnDetection.SemanticVad
asSemanticVad()
Server-side semantic turn detection which uses a model to determine when the user has finished speaking. final Optional<JsonValue>
_json()
final <T extends Any> T
accept(RealtimeSession.TurnDetection.Visitor<T> visitor)
final RealtimeSession.TurnDetection
validate()
final Boolean
isValid()
Boolean
equals(Object other)
Integer
hashCode()
String
toString()
final static RealtimeSession.TurnDetection
ofServerVad(RealtimeSession.TurnDetection.ServerVad serverVad)
Server-side voice activity detection (VAD) which flips on when user speech is detected and off after a period of silence. final static RealtimeSession.TurnDetection
ofSemanticVad(RealtimeSession.TurnDetection.SemanticVad semanticVad)
Server-side semantic turn detection which uses a model to determine when the user has finished speaking. -
-
Method Detail
-
serverVad
final Optional<RealtimeSession.TurnDetection.ServerVad> serverVad()
Server-side voice activity detection (VAD) which flips on when user speech is detected and off after a period of silence.
-
semanticVad
final Optional<RealtimeSession.TurnDetection.SemanticVad> semanticVad()
Server-side semantic turn detection which uses a model to determine when the user has finished speaking.
-
isServerVad
final Boolean isServerVad()
-
isSemanticVad
final Boolean isSemanticVad()
-
asServerVad
final RealtimeSession.TurnDetection.ServerVad asServerVad()
Server-side voice activity detection (VAD) which flips on when user speech is detected and off after a period of silence.
-
asSemanticVad
final RealtimeSession.TurnDetection.SemanticVad asSemanticVad()
Server-side semantic turn detection which uses a model to determine when the user has finished speaking.
-
accept
final <T extends Any> T accept(RealtimeSession.TurnDetection.Visitor<T> visitor)
-
validate
final RealtimeSession.TurnDetection validate()
-
ofServerVad
final static RealtimeSession.TurnDetection ofServerVad(RealtimeSession.TurnDetection.ServerVad serverVad)
Server-side voice activity detection (VAD) which flips on when user speech is detected and off after a period of silence.
-
ofSemanticVad
final static RealtimeSession.TurnDetection ofSemanticVad(RealtimeSession.TurnDetection.SemanticVad semanticVad)
Server-side semantic turn detection which uses a model to determine when the user has finished speaking.
-
-
-
-