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.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MotorTranscriptFormatterRequest.Builder
Builder class forMotorSummaryRequest
. -
Method Summary
Modifier and Type Method Description String
aiModel()
Gets the AI model to be used in the request.MotorAiOptions
aiOptions()
Gets the AI options to be used in the request.static MotorTranscriptFormatterRequest.Builder
builder()
Returns a new builder instance for creating aMotorTranscriptFormatterRequest
.ChatMotor
chatMotor()
Gets the ChatMotor to be used in the request.MotorLargeResponse
execute()
Executes the transcript formatter request and returns the response.String
filePath()
Gets the file path to be used in the request.ChunkSize
inputChunkSize()
Returns the input chunk size
-
Method Details
-
builder
Returns a new builder instance for creating aMotorTranscriptFormatterRequest
.- Returns:
- a new
MotorTranscriptFormatterRequest
builder
-
chatMotor
Gets the ChatMotor to be used in the request.- Returns:
- the
-
aiOptions
Gets the AI options to be used in the request.- Returns:
- the AI options to be used in the request
-
aiModel
Gets the AI model to be used in the request.- Returns:
- the AI model to be used in the request
-
filePath
Gets the file path to be used in the request.- Returns:
- the file path to be used in the request
-
inputChunkSize
Returns the input chunk size- Returns:
- the input chunk size
-
execute
Executes the transcript formatter request and returns the response.- Returns:
MotorLargeResponse
encapsulating the result of the transcription attempt.
-