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 Details

    • Builder

      public Builder()
      Sets default values for the ChatMotor.
    • Builder

      public Builder​(ChatMotor chatMotor)
      Creates a new Builder initialized with the current values of this ChatMotor instance.
      Parameters:
      chatMotor - the ChatMotor instance
  • Method Details

    • chatMotorHome

      public ChatMotor.Builder chatMotorHome​(String chatMotorHome)
      Sets the installation directory of ChatMotor
      Parameters:
      chatMotorHome - the installation directory of ChatMotor
      Returns:
      this Builder instance for chaining
    • apiKey

      public ChatMotor.Builder apiKey​(String apiKey)
      Sets the API key for the ChatMotor.
      Parameters:
      apiKey - the OpenAI API key
      Returns:
      this Builder instance for chaining
    • failoverApiKey

      public ChatMotor.Builder failoverApiKey​(String failoverApiKey)
      Sets the failover / secondary API key for the ChatMotor.
      Parameters:
      failoverApiKey - the failover / secondary API key
      Returns:
      this Builder instance for chaining
    • httpClient

      public ChatMotor.Builder httpClient​(HttpClient httpClient)
      Sets the HttpClient for the ChatMotor.
      Parameters:
      httpClient - the HttpClient to be used for network requests
      Returns:
      this Builder instance for chaining
    • organizationId

      public ChatMotor.Builder organizationId​(String organizationId)
      Sets the organization ID for the API usage.
      Parameters:
      organizationId - the organization ID
      Returns:
      this Builder instance for chaining
    • projectId

      public ChatMotor.Builder projectId​(String projectId)
      Sets the project ID for the API usage.
      Parameters:
      projectId - the project ID to set
      Returns:
      this Builder instance for chaining
    • maxRetries

      public ChatMotor.Builder maxRetries​(int maxRetries)
      Sets the maximum number of retries for the API requests.
      Parameters:
      maxRetries - Maximum number of retries.
      Returns:
      this Builder instance for chaining
    • retryInterval

      public ChatMotor.Builder retryInterval​(Duration 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

      public ChatMotor.Builder charset​(Charset 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

      public ChatMotor.Builder charset​(String 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

      public ChatMotor.Builder timeout​(Duration timeout)
      Sets the timeout for the ChatMotor.
      Parameters:
      timeout - the timeout for the ChatMotor
      Returns:
      this Builder instance for chaining
    • nThreads

      public ChatMotor.Builder nThreads​(int 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

      public ChatMotor.Builder maxInputSize​(ChunkSize maxInputSize)
      Sets the maximum input size for non-isomorphic operations, (Summaries, text explanation, etc.) Defaults to DEFAULT_MAX_INPUT_SIZE.
      Parameters:
      maxInputSize - the maximum input size for non-isomorphic operations
      Returns:
      this Builder instance for chaining
    • maxChunkInputSize

      public ChatMotor.Builder maxChunkInputSize​(ChunkSize maxChunkInputSize)
      Sets the maximum input size for isomorphic operations, (CSV line per line bulk treatments, translations, etc.) Defaults to DEFAULT_MAX_CHUNK_INPUT_SIZE.
      Parameters:
      maxChunkInputSize - the maximum input size for isomorphic operations
      Returns:
      this Builder instance for chaining
    • failoverNotifier

      public ChatMotor.Builder failoverNotifier​(FailoverNotifier failoverNotifier)
      Sets the failover notifier for handling API failures.
      Parameters:
      failoverNotifier - the failover notifier to be used
      Returns:
      this Builder instance for chaining
    • build

      public ChatMotor 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.