Class MotorCategorizationRequest

java.lang.Object
com.chatmotorapi.api.functional.MotorCategorizationRequest
All Implemented Interfaces:
MotorResponseType

public class MotorCategorizationRequest
extends Object
implements MotorResponseType
Handles the creation and execution of categorization using the ChatMotor API. It includes configuration for the text file to be The model to be used in requests can be specified with the .aiModel setter directly on the MotorCategorizationRequest builder. If .aiModel is not called, the default model used is System.getenv("MOTOR_CHAT_MODEL"). If the environment variable is not set, the model used is MotorDefaultsModels.MOTOR_CHAT_MODEL
In this version, for simplicity, responses are available in English only.

Usage example:

 String documentPath = "/path/to/my_document.txt";
 
 // We assume that the env var MOTOR_API_KEY is set.
 ChatMotor chatMotor = ChatMotor.builder().build();
 
 MotorCategorizationRequest request = MotorCategorizationRequest.builder()
        .chatMotor(chatMotor)
        .filePath(documentPath)
        .build();
 
 MotorCategorizationResponse motorResponse = request.execute();
 
 if (motorResponse.isResponseOk()) {
     System.out.println(motorResponse.getResponse());
 } else {
     // Treat errors
     // See the MotorSentimentResponse class for more details.
 }
 
  • Method Details

    • chatMotor

      public ChatMotor chatMotor()
      Gets the ChatMotor to be used in the request.
      Returns:
      the
    • aiOptions

      public MotorAiOptions aiOptions()
      Gets the AI options to be used in the request.
      Returns:
      the AI options to be used in the request
    • aiModel

      public String aiModel()
      Gets the AI model to be used in the request.
      Returns:
      the AI model to be used in the request
    • filePath

      public String filePath()
      Gets the file path to be used in the request.
      Returns:
      the file path to be used in the request
    • builder

      public static MotorCategorizationRequest.Builder builder()
      Returns a new builder instance for creating a MotorCategorizationRequest.
      Returns:
      a new MotorCategorizationRequest builder
    • execute

      public MotorCategorizationResponse execute()
      Executes the process of generating a sentiment analysis from a specified file using a GPT model.

      Workflow:

      • Reads the text content from a file.
      • Returns a MotorResponse indicating success or failure, along with any generated data file or errors.
      Returns:
      true the MotorResponse object
      See Also:
      MotorResponse