Package com.chatmotorapi.api
Class ChatMotor.Builder
java.lang.Object
com.chatmotorapi.api.ChatMotor.Builder
- Enclosing class:
- ChatMotor
public static class ChatMotor.Builder extends Object
The Builder class for the ChatMotor class.
Provides methods to set up and configure a ChatMotor instance.
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description ChatMotor.Builder
apiKey(String apiKey)
Sets the API key for the ChatMotor.ChatMotor
build()
Builds and returns a ChatMotor instance configured with this builder's parameters.ChatMotor.Builder
charset(String charset)
Sets the charset for reading and writing text fileChatMotor.Builder
charset(Charset charset)
Sets the charset for reading and writing text fileChatMotor.Builder
chatMotorHome(String chatMotorHome)
Sets the installation directory of ChatMotorChatMotor.Builder
failoverApiKey(String failoverApiKey)
Sets the failover / secondary API key for the ChatMotor.ChatMotor.Builder
failoverNotifier(FailoverNotifier failoverNotifier)
Sets the failover notifier for handling API failures.ChatMotor.Builder
httpClient(HttpClient httpClient)
Sets the HttpClient for the ChatMotor.ChatMotor.Builder
maxChunkInputSize(ChunkSize maxChunkInputSize)
Sets the maximum input size for isomorphic operations, (CSV line per line bulk treatments, translations, etc.)ChatMotor.Builder
maxInputSize(ChunkSize maxInputSize)
Sets the maximum input size for non-isomorphic operations, (Summaries, text explanation, etc.)ChatMotor.Builder
maxRetries(int maxRetries)
Sets the maximum number of retries for the API requests.ChatMotor.Builder
nThreads(int nThreads)
Sets the number of threads for processing large inputs.ChatMotor.Builder
organizationId(String organizationId)
Sets the organization ID for the API usage.ChatMotor.Builder
projectId(String projectId)
Sets the project ID for the API usage.ChatMotor.Builder
retryInterval(Duration retryInterval)
Sets the interval between retries for API requests.ChatMotor.Builder
timeout(Duration timeout)
Sets the timeout for the ChatMotor.
-
Constructor Details
-
Builder
public Builder()Sets default values for the ChatMotor. -
Builder
Creates a new Builder initialized with the current values of this ChatMotor instance.- Parameters:
chatMotor
- the ChatMotor instance
-
-
Method Details
-
chatMotorHome
Sets the installation directory of ChatMotor- Parameters:
chatMotorHome
- the installation directory of ChatMotor- Returns:
- this Builder instance for chaining
-
apiKey
Sets the API key for the ChatMotor.- Parameters:
apiKey
- the OpenAI API key- Returns:
- this Builder instance for chaining
-
failoverApiKey
Sets the failover / secondary API key for the ChatMotor.- Parameters:
failoverApiKey
- the failover / secondary API key- Returns:
- this Builder instance for chaining
-
httpClient
Sets the HttpClient for the ChatMotor.- Parameters:
httpClient
- the HttpClient to be used for network requests- Returns:
- this Builder instance for chaining
-
organizationId
Sets the organization ID for the API usage.- Parameters:
organizationId
- the organization ID- Returns:
- this Builder instance for chaining
-
projectId
Sets the project ID for the API usage.- Parameters:
projectId
- the project ID to set- Returns:
- this Builder instance for chaining
-
maxRetries
Sets the maximum number of retries for the API requests.- Parameters:
maxRetries
- Maximum number of retries.- Returns:
- this Builder instance for chaining
-
retryInterval
Sets the interval between retries for API requests.- Parameters:
retryInterval
- The time to wait between retry attempt- Returns:
- this Builder instance for chaining
-
charset
Sets the charset for reading and writing text file- Parameters:
charset
- the charset for reading and writing text file- Returns:
- this Builder instance for chaining
-
charset
Sets the charset for reading and writing text file- Parameters:
charset
- the charset for reading and writing text file- Returns:
- this Builder instance for chaining
-
timeout
Sets the timeout for the ChatMotor.- Parameters:
timeout
- the timeout for the ChatMotor- Returns:
- this Builder instance for chaining
-
nThreads
Sets the number of threads for processing large inputs. Default value is 40.- Parameters:
nThreads
- the number of threads to be used for processing large inputs.- Returns:
- this Builder instance for chaining
-
maxInputSize
Sets the maximum input size for non-isomorphic operations, (Summaries, text explanation, etc.) Defaults toDEFAULT_MAX_INPUT_SIZE
.- Parameters:
maxInputSize
- the maximum input size for non-isomorphic operations- Returns:
- this Builder instance for chaining
-
maxChunkInputSize
Sets the maximum input size for isomorphic operations, (CSV line per line bulk treatments, translations, etc.) Defaults toDEFAULT_MAX_CHUNK_INPUT_SIZE
.- Parameters:
maxChunkInputSize
- the maximum input size for isomorphic operations- Returns:
- this Builder instance for chaining
-
failoverNotifier
Sets the failover notifier for handling API failures.- Parameters:
failoverNotifier
- the failover notifier to be used- Returns:
- this Builder instance for chaining
-
build
Builds and returns a ChatMotor instance configured with this builder's parameters. This method finalizes the configuration of the ChatMotor by setting various parameters required for its operation. It also performs checks to ensure all necessary parameters are properly initialized before creating the ChatMotor instance.- Returns:
- a new ChatMotor instance, fully configured and ready to be used.
- Throws:
IllegalArgumentException
- if apiKey is not provided, or licenseFilePath is not provided or invalid, or if the charset specified is not supported.
-