Class TranscriptionRequest

java.lang.Object
com.codename1.media.TranscriptionRequest

public final class TranscriptionRequest extends Object
File transcription request shared by transcription providers.
  • Constructor Details

    • TranscriptionRequest

      public TranscriptionRequest(String audioPath)
      Creates a file-based transcription request.
      Parameters:
      audioPath - path to the audio file that should be transcribed
      Throws:
      IllegalArgumentException - if audioPath is null or empty
  • Method Details

    • file

      public static TranscriptionRequest file(String audioPath)
      Creates a file-based transcription request.
      Parameters:
      audioPath - path to the audio file that should be transcribed
      Returns:
      a new transcription request
    • getAudioPath

      public String getAudioPath()
      Gets the audio file path.
      Returns:
      audio file path
    • getLanguageTag

      public String getLanguageTag()
      Gets the requested recognition language.
      Returns:
      BCP 47 language tag, or null if the provider should choose its default
    • setLanguageTag

      public TranscriptionRequest setLanguageTag(String languageTag)
      Sets the requested recognition language.
      Parameters:
      languageTag - BCP 47 language tag, or null to let the provider choose
      Returns:
      this request
    • getPrompt

      public String getPrompt()
      Gets the optional provider prompt.
      Returns:
      prompt text, or null if no prompt is set
    • setPrompt

      public TranscriptionRequest setPrompt(String prompt)
      Sets optional provider prompt text.
      Parameters:
      prompt - prompt text, or null to clear it
      Returns:
      this request
    • setOption

      public TranscriptionRequest setOption(String key, String value)

      Sets an optional provider-specific value.

      Passing null as the value removes the option.

      Parameters:
      key - option key
      value - option value, or null to remove the option
      Returns:
      this request
      Throws:
      IllegalArgumentException - if key is null or empty
    • getOption

      public String getOption(String key)
      Gets a provider-specific option value.
      Parameters:
      key - option key
      Returns:
      option value, or null if it is not set
    • getOptions

      public Map<String,String> getOptions()
      Gets all provider-specific options.
      Returns:
      immutable option map