Class TranscriptionStreamEvent
-
- All Implemented Interfaces:
public final class TranscriptionStreamEventEmitted when a diarized transcription returns a completed segment with speaker information. Only emitted when you create a transcription with
streamset totrueandresponse_formatset todiarized_json.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceTranscriptionStreamEvent.VisitorAn interface that defines how to map each variant of TranscriptionStreamEvent to a value of type T.
-
Method Summary
Modifier and Type Method Description final Optional<TranscriptionTextSegmentEvent>transcriptTextSegment()Emitted when a diarized transcription returns a completed segment with speaker information. final Optional<TranscriptionTextDeltaEvent>transcriptTextDelta()Emitted when there is an additional text delta. final Optional<TranscriptionTextDoneEvent>transcriptTextDone()Emitted when the transcription is complete. final BooleanisTranscriptTextSegment()final BooleanisTranscriptTextDelta()final BooleanisTranscriptTextDone()final TranscriptionTextSegmentEventasTranscriptTextSegment()Emitted when a diarized transcription returns a completed segment with speaker information. final TranscriptionTextDeltaEventasTranscriptTextDelta()Emitted when there is an additional text delta. final TranscriptionTextDoneEventasTranscriptTextDone()Emitted when the transcription is complete. final Optional<JsonValue>_json()final <T extends Any> Taccept(TranscriptionStreamEvent.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final TranscriptionStreamEventvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static TranscriptionStreamEventofTranscriptTextSegment(TranscriptionTextSegmentEvent transcriptTextSegment)Emitted when a diarized transcription returns a completed segment with speaker information. final static TranscriptionStreamEventofTranscriptTextDelta(TranscriptionTextDeltaEvent transcriptTextDelta)Emitted when there is an additional text delta. final static TranscriptionStreamEventofTranscriptTextDone(TranscriptionTextDoneEvent transcriptTextDone)Emitted when the transcription is complete. -
-
Method Detail
-
transcriptTextSegment
final Optional<TranscriptionTextSegmentEvent> transcriptTextSegment()
Emitted when a diarized transcription returns a completed segment with speaker information. Only emitted when you create a transcription with
streamset totrueandresponse_formatset todiarized_json.
-
transcriptTextDelta
final Optional<TranscriptionTextDeltaEvent> transcriptTextDelta()
Emitted when there is an additional text delta. This is also the first event emitted when the transcription starts. Only emitted when you create a transcription with the
Streamparameter set totrue.
-
transcriptTextDone
final Optional<TranscriptionTextDoneEvent> transcriptTextDone()
Emitted when the transcription is complete. Contains the complete transcription text. Only emitted when you create a transcription with the
Streamparameter set totrue.
-
isTranscriptTextSegment
final Boolean isTranscriptTextSegment()
-
isTranscriptTextDelta
final Boolean isTranscriptTextDelta()
-
isTranscriptTextDone
final Boolean isTranscriptTextDone()
-
asTranscriptTextSegment
final TranscriptionTextSegmentEvent asTranscriptTextSegment()
Emitted when a diarized transcription returns a completed segment with speaker information. Only emitted when you create a transcription with
streamset totrueandresponse_formatset todiarized_json.
-
asTranscriptTextDelta
final TranscriptionTextDeltaEvent asTranscriptTextDelta()
Emitted when there is an additional text delta. This is also the first event emitted when the transcription starts. Only emitted when you create a transcription with the
Streamparameter set totrue.
-
asTranscriptTextDone
final TranscriptionTextDoneEvent asTranscriptTextDone()
Emitted when the transcription is complete. Contains the complete transcription text. Only emitted when you create a transcription with the
Streamparameter set totrue.
-
accept
final <T extends Any> T accept(TranscriptionStreamEvent.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 = transcriptionStreamEvent.accept(new TranscriptionStreamEvent.Visitor<Optional<String>>() { @Override public Optional<String> visitTranscriptTextSegment(TranscriptionTextSegmentEvent transcriptTextSegment) { return Optional.of(transcriptTextSegment.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final TranscriptionStreamEvent 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.
-
ofTranscriptTextSegment
final static TranscriptionStreamEvent ofTranscriptTextSegment(TranscriptionTextSegmentEvent transcriptTextSegment)
Emitted when a diarized transcription returns a completed segment with speaker information. Only emitted when you create a transcription with
streamset totrueandresponse_formatset todiarized_json.
-
ofTranscriptTextDelta
final static TranscriptionStreamEvent ofTranscriptTextDelta(TranscriptionTextDeltaEvent transcriptTextDelta)
Emitted when there is an additional text delta. This is also the first event emitted when the transcription starts. Only emitted when you create a transcription with the
Streamparameter set totrue.
-
ofTranscriptTextDone
final static TranscriptionStreamEvent ofTranscriptTextDone(TranscriptionTextDoneEvent transcriptTextDone)
Emitted when the transcription is complete. Contains the complete transcription text. Only emitted when you create a transcription with the
Streamparameter set totrue.
-
-
-
-