Class MotorImageRequest.Builder

java.lang.Object
com.chatmotorapi.api.image.MotorImageRequest.Builder
Enclosing class:
MotorImageRequest

public static class MotorImageRequest.Builder
extends Object
Builder class for creating a MotorImageRequest instance.
  • Constructor Details

    • Builder

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

    • prompt

      public MotorImageRequest.Builder prompt​(String prompt)
      Sets the prompt for the API request.
      Parameters:
      prompt - the timeout value
      Returns:
      this Builder instance for chaining
    • chatMotor

      public MotorImageRequest.Builder chatMotor​(ChatMotor chatMotor)
      Sets the ChatMotor instance to be used for the request.
      Parameters:
      chatMotor - the ChatMotor instance
      Returns:
      this Builder instance for chaining
    • aiModel

      public MotorImageRequest.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
    • motorImageSize

      public MotorImageRequest.Builder motorImageSize​(MotorImageSize motorImageSize)
      Sets the image size for the API request.
      Parameters:
      motorImageSize - the image size
      Returns:
      this Builder instance for chaining
    • responseImageFormat

      public MotorImageRequest.Builder responseImageFormat​(ResponseImageFormat responseImageFormat)
      Sets the response image format for the API request.
      Parameters:
      responseImageFormat - the response format: ResponseImageFormat.URL or ResponseImageFormat.BASE64
      Returns:
      this Builder instance for chaining
    • n

      public MotorImageRequest.Builder n​(int n)
      Sets the n of images to generate or the API request.
      Parameters:
      n - n of images to generate
      Returns:
      this Builder instance for chaining
    • build

      public MotorImageRequest build()
      Builds and returns a MotorImageRequest instance based on the set parameters.
      Returns:
      a new MotorImageRequest
      Throws:
      IllegalArgumentException - if the chatMotor is not provided.
      IllegalArgumentException - if the prompt is not provided.
      IllegalArgumentException - if n is not between 1 and 10.
      IllegalArgumentException - if the motorImageSize is not provided.
      IllegalArgumentException - if the responseImageFormat is not provided.