createLanguageModel method
- required BaseModelName baseModelName,
- required InputDataConfig inputDataConfig,
- required CLMLanguageCode languageCode,
- required String modelName,
Creates a new custom language model. Use Amazon S3 prefixes to provide the location of your input files. The time it takes to create your model depends on the size of your training data.
May throw BadRequestException. May throw LimitExceededException. May throw InternalFailureException. May throw ConflictException.
Parameter baseModelName
:
The Amazon Transcribe standard language model, or base model used to
create your custom language model.
If you want to use your custom language model to transcribe audio with a
sample rate of 16 kHz or greater, choose Wideband
.
If you want to use your custom language model to transcribe audio with a
sample rate that is less than 16 kHz, choose Narrowband
.
Parameter inputDataConfig
:
Contains the data access role and the Amazon S3 prefixes to read the
required input files to create a custom language model.
Parameter languageCode
:
The language of the input text you're using to train your custom language
model.
Parameter modelName
:
The name you choose for your custom language model when you create it.
Implementation
Future<CreateLanguageModelResponse> createLanguageModel({
required BaseModelName baseModelName,
required InputDataConfig inputDataConfig,
required CLMLanguageCode languageCode,
required String modelName,
}) async {
ArgumentError.checkNotNull(baseModelName, 'baseModelName');
ArgumentError.checkNotNull(inputDataConfig, 'inputDataConfig');
ArgumentError.checkNotNull(languageCode, 'languageCode');
ArgumentError.checkNotNull(modelName, 'modelName');
_s.validateStringLength(
'modelName',
modelName,
1,
200,
isRequired: true,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'Transcribe.CreateLanguageModel'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'BaseModelName': baseModelName.toValue(),
'InputDataConfig': inputDataConfig,
'LanguageCode': languageCode.toValue(),
'ModelName': modelName,
},
);
return CreateLanguageModelResponse.fromJson(jsonResponse.body);
}