Class OpenAiAudioTranscriptionResponseMetadata
java.lang.Object
org.springframework.ai.model.MutableResponseMetadata
org.springframework.ai.audio.transcription.AudioTranscriptionResponseMetadata
org.springframework.ai.openai.metadata.OpenAiAudioTranscriptionResponseMetadata
- All Implemented Interfaces:
ResponseMetadata
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable DoubleReturns the audio duration in seconds, ornullif not returned by the API.@Nullable StringReturns the detected input language, ornullif not returned by the API.@Nullable List<?>Returns the segment-level transcription breakdown, ornullif not returned by the API.@Nullable ObjectgetUsage()Returns the provider-native usage object for this transcription, ornullif not returned by the API.@Nullable List<com.openai.models.audio.transcriptions.TranscriptionWord>getWords()Returns the word-level timestamps, ornullif not returned by the API.toString()Methods inherited from class org.springframework.ai.model.MutableResponseMetadata
clear, computeIfAbsent, containsKey, entrySet, get, getOrDefault, getRawMap, getRequired, isEmpty, keySet, put, removeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.ai.model.ResponseMetadata
getOrDefault
-
Constructor Details
-
OpenAiAudioTranscriptionResponseMetadata
public OpenAiAudioTranscriptionResponseMetadata() -
OpenAiAudioTranscriptionResponseMetadata
-
-
Method Details
-
getDuration
Returns the audio duration in seconds, ornullif not returned by the API. -
getLanguage
Returns the detected input language, ornullif not returned by the API. -
getUsage
Returns the provider-native usage object for this transcription, ornullif not returned by the API. The concrete type depends on the response format requested:TranscriptionVerbose.Usageforverbose_json,TranscriptionDiarized.Usagefordiarized_json, orTranscription.Usageotherwise. -
getSegments
Returns the segment-level transcription breakdown, ornullif not returned by the API. Elements areTranscriptionSegmentforverbose_json, orTranscriptionDiarizedSegment(carrying per-speaker attribution) fordiarized_json. -
getWords
Returns the word-level timestamps, ornullif not returned by the API. Only populated forverbose_jsonwhen word-leveltimestamp_granularitieswere requested. -
toString
-