Class RealtimeAudioConfigOutput.Voice
-
- All Implemented Interfaces:
public final class RealtimeAudioConfigOutput.VoiceThe voice the model uses to respond. Supported built-in voices are
alloy,ash,ballad,coral,echo,sage,shimmer,verse,marin, andcedar. You may also provide a custom voice object with anid, for example{ "id": "voice_1234" }. Voice cannot be changed during the session once the model has responded with audio at least once. We recommendmarinandcedarfor best quality.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceRealtimeAudioConfigOutput.Voice.VisitorAn interface that defines how to map each variant of Voice to a value of type T.
public final classRealtimeAudioConfigOutput.Voice.UnionMember1public final classRealtimeAudioConfigOutput.Voice.IdCustom voice reference.
-
Method Summary
-
-
Method Detail
-
unionMember1
final Optional<RealtimeAudioConfigOutput.Voice.UnionMember1> unionMember1()
-
id
final Optional<RealtimeAudioConfigOutput.Voice.Id> id()
Custom voice reference.
-
isUnionMember1
final Boolean isUnionMember1()
-
asUnionMember1
final RealtimeAudioConfigOutput.Voice.UnionMember1 asUnionMember1()
-
asId
final RealtimeAudioConfigOutput.Voice.Id asId()
Custom voice reference.
-
accept
final <T extends Any> T accept(RealtimeAudioConfigOutput.Voice.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 = voice.accept(new Voice.Visitor<Optional<String>>() { @Override public Optional<String> visitString(String string) { return Optional.of(string.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final RealtimeAudioConfigOutput.Voice 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.
-
ofString
final static RealtimeAudioConfigOutput.Voice ofString(String string)
-
ofUnionMember1
final static RealtimeAudioConfigOutput.Voice ofUnionMember1(RealtimeAudioConfigOutput.Voice.UnionMember1 unionMember1)
-
ofId
final static RealtimeAudioConfigOutput.Voice ofId(RealtimeAudioConfigOutput.Voice.Id id)
Custom voice reference.
-
-
-
-