Class RealtimeAudioInputTurnDetection
-
- All Implemented Interfaces:
public final class RealtimeAudioInputTurnDetectionConfiguration for turn detection, ether Server VAD or Semantic VAD. This can be set to
nullto 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.
For
gpt-realtime-whispertranscription sessions, turn detection must be set tonull; VAD is not supported.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceRealtimeAudioInputTurnDetection.VisitorAn interface that defines how to map each variant of RealtimeAudioInputTurnDetection to a value of type T.
public final classRealtimeAudioInputTurnDetection.ServerVadServer-side voice activity detection (VAD) which flips on when user speech is detected and off after a period of silence.
public final classRealtimeAudioInputTurnDetection.SemanticVadServer-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<RealtimeAudioInputTurnDetection.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<RealtimeAudioInputTurnDetection.SemanticVad>semanticVad()Server-side semantic turn detection which uses a model to determine when the user has finished speaking. final BooleanisServerVad()final BooleanisSemanticVad()final RealtimeAudioInputTurnDetection.ServerVadasServerVad()Server-side voice activity detection (VAD) which flips on when user speech is detected and off after a period of silence. final RealtimeAudioInputTurnDetection.SemanticVadasSemanticVad()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> Taccept(RealtimeAudioInputTurnDetection.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final RealtimeAudioInputTurnDetectionvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static RealtimeAudioInputTurnDetectionofServerVad(RealtimeAudioInputTurnDetection.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 RealtimeAudioInputTurnDetectionofSemanticVad(RealtimeAudioInputTurnDetection.SemanticVad semanticVad)Server-side semantic turn detection which uses a model to determine when the user has finished speaking. -
-
Method Detail
-
serverVad
final Optional<RealtimeAudioInputTurnDetection.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<RealtimeAudioInputTurnDetection.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 RealtimeAudioInputTurnDetection.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 RealtimeAudioInputTurnDetection.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(RealtimeAudioInputTurnDetection.Visitor<T> visitor)
Maps this instance's current variant to a value of type T using the given visitor.
Note that this method is not forwards compatible with new variants from the API, unless visitor overrides Visitor.unknown. To handle variants not known to this version of the SDK gracefully, consider overriding Visitor.unknown:
import com.openai.core.JsonValue; import java.util.Optional; Optional<String> result = realtimeAudioInputTurnDetection.accept(new RealtimeAudioInputTurnDetection.Visitor<Optional<String>>() { @Override public Optional<String> visitServerVad(ServerVad serverVad) { return Optional.of(serverVad.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final RealtimeAudioInputTurnDetection validate()
Validates that the types of all values in this object match their expected types recursively.
This method is not forwards compatible with new types from the API for existing fields.
-
ofServerVad
final static RealtimeAudioInputTurnDetection ofServerVad(RealtimeAudioInputTurnDetection.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 RealtimeAudioInputTurnDetection ofSemanticVad(RealtimeAudioInputTurnDetection.SemanticVad semanticVad)
Server-side semantic turn detection which uses a model to determine when the user has finished speaking.
-
-
-
-