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.BuilderaiModel(String aiModel)Sets the OpenAI model to use for the requestMotorLargeTranslationRequestbuild()Builds and returns aMotorLargeTranslationRequestinstance based on the set parameters.MotorLargeTranslationRequest.BuilderchatMotor(ChatMotor chatMotor)Sets theChatMotorinstance for this request.MotorLargeTranslationRequest.BuilderfilePath(String filePath)Sets the file path of the text document to translate.MotorLargeTranslationRequest.BuilderinputChunkSize(ChunkSize inputChunkSize)Sets the input chunk size.MotorLargeTranslationRequest.BuilderlanguageCode(String languageCode)Sets the language code for the translation .MotorLargeTranslationRequest.BuildermotorAiOptions(MotorAiOptions aiOptions)Sets the MotorAiOptions instance to be used for the request.MotorLargeTranslationRequest.BuilderprogressListener(ProgressListener progressListener)Sets the progress listener to track progress.MotorLargeTranslationRequest.BuilderuseInputStreaming(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 theChatMotorinstance for this request.- Parameters:
chatMotor- theChatMotorinstance- 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
useInputStreamingis true, the streaming implementation using Sax Parser and TagSoup is used. IfuseInputStreamingis 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 aMotorLargeTranslationRequestinstance 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.
-