Interface RealtimeTranslationServerEvent.Visitor
-
- All Implemented Interfaces:
public interface RealtimeTranslationServerEvent.Visitor<T extends Object>An interface that defines how to map each variant of RealtimeTranslationServerEvent to a value of type T.
-
-
Method Summary
Modifier and Type Method Description abstract TvisitError(RealtimeErrorEvent error)Returned when an error occurs, which could be a client problem or a server problem. abstract TvisitSessionCreated(RealtimeTranslationSessionCreatedEvent sessionCreated)Returned when a translation session is created. abstract TvisitSessionUpdated(RealtimeTranslationSessionUpdatedEvent sessionUpdated)Returned when a translation session is updated with a session.updateevent, unless there is an error.abstract TvisitSessionClosed(RealtimeTranslationSessionClosedEvent sessionClosed)Returned when a realtime translation session is closed. abstract TvisitSessionInputTranscriptDelta(RealtimeTranslationInputTranscriptDeltaEvent sessionInputTranscriptDelta)Returned when optional source-language transcript text is available. abstract TvisitSessionOutputTranscriptDelta(RealtimeTranslationOutputTranscriptDeltaEvent sessionOutputTranscriptDelta)Returned when translated transcript text is available. abstract TvisitSessionOutputAudioDelta(RealtimeTranslationOutputAudioDeltaEvent sessionOutputAudioDelta)Returned when translated output audio is available. Tunknown(JsonValue json)Maps an unknown variant of RealtimeTranslationServerEvent to a value of type T. -
-
Method Detail
-
visitError
abstract T visitError(RealtimeErrorEvent error)
Returned when an error occurs, which could be a client problem or a server problem. Most errors are recoverable and the session will stay open, we recommend to implementors to monitor and log error messages by default.
-
visitSessionCreated
abstract T visitSessionCreated(RealtimeTranslationSessionCreatedEvent sessionCreated)
Returned when a translation session is created. Emitted automatically when a new connection is established as the first server event. This event contains the default translation session configuration.
-
visitSessionUpdated
abstract T visitSessionUpdated(RealtimeTranslationSessionUpdatedEvent sessionUpdated)
Returned when a translation session is updated with a
session.updateevent, unless there is an error.
-
visitSessionClosed
abstract T visitSessionClosed(RealtimeTranslationSessionClosedEvent sessionClosed)
Returned when a realtime translation session is closed.
-
visitSessionInputTranscriptDelta
abstract T visitSessionInputTranscriptDelta(RealtimeTranslationInputTranscriptDeltaEvent sessionInputTranscriptDelta)
Returned when optional source-language transcript text is available. This event is emitted only when
audio.input.transcriptionis configured.Transcript deltas are append-only text fragments. Clients should not insert unconditional spaces between deltas.
-
visitSessionOutputTranscriptDelta
abstract T visitSessionOutputTranscriptDelta(RealtimeTranslationOutputTranscriptDeltaEvent sessionOutputTranscriptDelta)
Returned when translated transcript text is available.
Transcript deltas are append-only text fragments. Clients should not insert unconditional spaces between deltas.
-
visitSessionOutputAudioDelta
abstract T visitSessionOutputAudioDelta(RealtimeTranslationOutputAudioDeltaEvent sessionOutputAudioDelta)
Returned when translated output audio is available. Output audio deltas are 200 ms frames of PCM16 audio.
-
unknown
T unknown(JsonValue json)
Maps an unknown variant of RealtimeTranslationServerEvent to a value of type T.
An instance of RealtimeTranslationServerEvent can contain an unknown variant if it was deserialized from data that doesn't match any known variant. For example, if the SDK is on an older version than the API, then the API may respond with new variants that the SDK is unaware of.
-
-
-
-