Class MotorTranscriptFormatterRequest

java.lang.Object
com.chatmotorapi.api.transcription.MotorTranscriptFormatterRequest

public class MotorTranscriptFormatterRequest
extends Object
Allows to format a transcription file with using line breaks and paragraphs. 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

Usage example:

 
 String transcriptionFilePath = "/path/to/transcription_file.txt";
        
 // We assume that the env var MOTOR_API_KEY is set.
 ChatMotor chatMotor = ChatMotor.builder()
        .build();
 
 MotorTranscriptFormatterRequest formatterRequest = MotorTranscriptFormatterRequest.builder()
     .chatMotor(chatMotor)
     .filePath(transcriptionFilePath)
     .build();

 MotorLargeResponse largeResponse = formatterRequest.execute();
 
 if (largeResponse.isResponseOk()) {
     try (InputStream in = largeResponse.getInputStream()) {
        String outFilePath = "/path/to/transcription_file_formatted.txt";
        Files.copy(in, Paths.get(outFilePath), StandardCopyOption.REPLACE_EXISTING);
     }
 } else {
     // Treat MotorLargeResponse
     // See the MotorLargeResponse class for more details.
 }
 
 

This class uses a builder pattern to ensure a flexible and secure way to configure each transcription request.

  • Method Details

    • builder

      public static MotorTranscriptFormatterRequest.Builder builder()
      Returns a new builder instance for creating a MotorTranscriptFormatterRequest.
      Returns:
      a new MotorTranscriptFormatterRequest builder
    • 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
    • inputChunkSize

      public ChunkSize inputChunkSize()
      Returns the input chunk size
      Returns:
      the input chunk size
    • execute

      public MotorLargeResponse execute()
      Executes the transcript formatter request and returns the response.
      Returns:
      MotorLargeResponse encapsulating the result of the transcription attempt.