Class OpenAiAudioTranscriptionResponseMetadata

All Implemented Interfaces:
ResponseMetadata

public class OpenAiAudioTranscriptionResponseMetadata extends AudioTranscriptionResponseMetadata
Audio transcription metadata implementation for OpenAI using the OpenAI Java SDK.

duration, usage and segment/word-level timestamps are only returned by the OpenAI API for the verbose_json and diarized_json response_format values; for other formats these accessors return null.

Author:
Christian Tzolov
  • Constructor Details

    • OpenAiAudioTranscriptionResponseMetadata

      public OpenAiAudioTranscriptionResponseMetadata()
    • OpenAiAudioTranscriptionResponseMetadata

      public OpenAiAudioTranscriptionResponseMetadata(@Nullable Double duration, @Nullable String language, @Nullable Object usage, @Nullable List<?> segments, @Nullable List<com.openai.models.audio.transcriptions.TranscriptionWord> words)
  • Method Details

    • getDuration

      public @Nullable Double getDuration()
      Returns the audio duration in seconds, or null if not returned by the API.
    • getLanguage

      public @Nullable String getLanguage()
      Returns the detected input language, or null if not returned by the API.
    • getUsage

      public @Nullable Object getUsage()
      Returns the provider-native usage object for this transcription, or null if not returned by the API. The concrete type depends on the response format requested: TranscriptionVerbose.Usage for verbose_json, TranscriptionDiarized.Usage for diarized_json, or Transcription.Usage otherwise.
    • getSegments

      public @Nullable List<?> getSegments()
      Returns the segment-level transcription breakdown, or null if not returned by the API. Elements are TranscriptionSegment for verbose_json, or TranscriptionDiarizedSegment (carrying per-speaker attribution) for diarized_json.
    • getWords

      public @Nullable List<com.openai.models.audio.transcriptions.TranscriptionWord> getWords()
      Returns the word-level timestamps, or null if not returned by the API. Only populated for verbose_json when word-level timestamp_granularities were requested.
    • toString

      public String toString()
      Overrides:
      toString in class Object