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 classMotorTranscriptFormatterRequest.BuilderBuilder class forMotorSummaryRequest. -
Method Summary
Modifier and Type Method Description StringaiModel()Gets the AI model to be used in the request.MotorAiOptionsaiOptions()Gets the AI options to be used in the request.static MotorTranscriptFormatterRequest.Builderbuilder()Returns a new builder instance for creating aMotorTranscriptFormatterRequest.ChatMotorchatMotor()Gets the ChatMotor to be used in the request.MotorLargeResponseexecute()Executes the transcript formatter request and returns the response.StringfilePath()Gets the file path to be used in the request.ChunkSizeinputChunkSize()Returns the input chunk size
-
Method Details
-
builder
Returns a new builder instance for creating aMotorTranscriptFormatterRequest.- Returns:
- a new
MotorTranscriptFormatterRequestbuilder
-
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:
MotorLargeResponseencapsulating the result of the transcription attempt.
-