Class MotorLargeTranslationRequest.Builder

java.lang.Object
com.chatmotorapi.api.functional.MotorLargeTranslationRequest.Builder
Enclosing class:
MotorLargeTranslationRequest

public static class MotorLargeTranslationRequest.Builder
extends Object
Builder class for MotorSummaryRequest.
  • Constructor Details

    • Builder

      public Builder()
      Sets default values for the Request.
  • Method Details

    • chatMotor

      public MotorLargeTranslationRequest.Builder chatMotor​(ChatMotor chatMotor)
      Sets the ChatMotor instance for this request.
      Parameters:
      chatMotor - the ChatMotor instance
      Returns:
      this builder instance for chaining
    • motorAiOptions

      public MotorLargeTranslationRequest.Builder motorAiOptions​(MotorAiOptions aiOptions)
      Sets the MotorAiOptions instance to be used for the request.
      Parameters:
      aiOptions - the MotorAiOptions instance
      Returns:
      this Builder instance for chaining
    • aiModel

      public MotorLargeTranslationRequest.Builder aiModel​(String aiModel)
      Sets the OpenAI model to use for the request
      Parameters:
      aiModel - the model identifier, e.g., "gpt-4-turbo-preview"
      Returns:
      this Builder instance for chaining
    • filePath

      public MotorLargeTranslationRequest.Builder filePath​(String filePath)
      Sets the file path of the text document to translate.
      The formats accepted are text and HTML files.
      Parameters:
      filePath - the file path of the text or HTML document to translate.
      Returns:
      this builder instance for chaining
    • languageCode

      public MotorLargeTranslationRequest.Builder languageCode​(String languageCode)
      Sets the language code for the translation .
      Parameters:
      languageCode - the language code for the translation .
      Returns:
      this Builder instance for chaining
    • inputChunkSize

      public MotorLargeTranslationRequest.Builder inputChunkSize​(ChunkSize inputChunkSize)
      Sets the input chunk size.

      Note: This method is generally not recommended for use. The default chunk size defined in ChatMotor.maxChunkInputSize() is used.

      Parameters:
      inputChunkSize - the input chunk size
      Returns:
      this builder instance for chaining
    • useInputStreaming

      public MotorLargeTranslationRequest.Builder useInputStreaming​(boolean useInputStreaming)
      Sets the implementation to use for large translation requests.

      If useInputStreaming is true, the streaming implementation using Sax Parser and TagSoup is used. If useInputStreaming is false, the Jsoup implementation that loads files in memory is used.
      Defaults to false.

      The streaming implementation is more efficient for large files but may be less robust in this beta.

      Parameters:
      useInputStreaming - if true, use the streaming implementation; if false, use the in-memory implementation
      Returns:
      this builder instance for chaining
    • progressListener

      public MotorLargeTranslationRequest.Builder progressListener​(ProgressListener progressListener)
      Sets the progress listener to track progress.
      Parameters:
      progressListener - the progress listener
      Returns:
      this builder instance for chaining
    • build

      Builds and returns a MotorLargeTranslationRequest instance based on the set parameters.
      Returns:
      a new MotorLargeTranslationRequest
      Throws:
      IllegalArgumentException - if the chatMotor is not provided.
      IllegalArgumentException - if the filePath is not provided.
      IllegalArgumentException - if the file specified by filePath does not exist.
      IllegalArgumentException - if the file format is not supported.