Package com.chatmotorapi.api.functional
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 Summary
Constructors Constructor Description Builder()
Sets default values for the Request. -
Method Summary
Modifier and Type Method Description MotorLargeTranslationRequest.Builder
aiModel(String aiModel)
Sets the OpenAI model to use for the requestMotorLargeTranslationRequest
build()
Builds and returns aMotorLargeTranslationRequest
instance based on the set parameters.MotorLargeTranslationRequest.Builder
chatMotor(ChatMotor chatMotor)
Sets theChatMotor
instance for this request.MotorLargeTranslationRequest.Builder
filePath(String filePath)
Sets the file path of the text document to translate.MotorLargeTranslationRequest.Builder
inputChunkSize(ChunkSize inputChunkSize)
Sets the input chunk size.MotorLargeTranslationRequest.Builder
languageCode(String languageCode)
Sets the language code for the translation .MotorLargeTranslationRequest.Builder
motorAiOptions(MotorAiOptions aiOptions)
Sets the MotorAiOptions instance to be used for the request.MotorLargeTranslationRequest.Builder
progressListener(ProgressListener progressListener)
Sets the progress listener to track progress.MotorLargeTranslationRequest.Builder
useInputStreaming(boolean useInputStreaming)
Sets the implementation to use for large translation requests.
-
Constructor Details
-
Builder
public Builder()Sets default values for the Request.
-
-
Method Details
-
chatMotor
Sets theChatMotor
instance for this request.- Parameters:
chatMotor
- theChatMotor
instance- Returns:
- this builder instance for chaining
-
motorAiOptions
Sets the MotorAiOptions instance to be used for the request.- Parameters:
aiOptions
- the MotorAiOptions instance- Returns:
- this Builder instance for chaining
-
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
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
Sets the language code for the translation .- Parameters:
languageCode
- the language code for the translation .- Returns:
- this Builder instance for chaining
-
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
Sets the implementation to use for large translation requests.If
useInputStreaming
is true, the streaming implementation using Sax Parser and TagSoup is used. IfuseInputStreaming
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
Sets the progress listener to track progress.- Parameters:
progressListener
- the progress listener- Returns:
- this builder instance for chaining
-
build
Builds and returns aMotorLargeTranslationRequest
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.
-