createFlywheel method
A flywheel is an Amazon Web Services resource that orchestrates the ongoing training of a model for custom classification or custom entity recognition. You can create a flywheel to start with an existing trained model, or Comprehend can create and train a new model.
When you create the flywheel, Comprehend creates a data lake in your account. The data lake holds the training data and test data for all versions of the model.
To use a flywheel with an existing trained model, you specify the active model version. Comprehend copies the model's training data and test data into the flywheel's data lake.
To use the flywheel with a new model, you need to provide a dataset for training data (and optional test data) when you create the flywheel.
For more information about flywheels, see Flywheel overview in the Amazon Comprehend Developer Guide.
May throw InternalServerException.
May throw InvalidRequestException.
May throw KmsKeyValidationException.
May throw ResourceInUseException.
May throw ResourceLimitExceededException.
May throw ResourceNotFoundException.
May throw ResourceUnavailableException.
May throw TooManyRequestsException.
May throw TooManyTagsException.
May throw UnsupportedLanguageException.
Parameter dataAccessRoleArn :
The Amazon Resource Name (ARN) of the IAM role that grants Amazon
Comprehend the permissions required to access the flywheel data in the
data lake.
Parameter dataLakeS3Uri :
Enter the S3 location for the data lake. You can specify a new S3 bucket
or a new folder of an existing S3 bucket. The flywheel creates the data
lake at this location.
Parameter flywheelName :
Name for the flywheel.
Parameter activeModelArn :
To associate an existing model with the flywheel, specify the Amazon
Resource Number (ARN) of the model version. Do not set
TaskConfig or ModelType if you specify an
ActiveModelArn.
Parameter clientRequestToken :
A unique identifier for the request. If you don't set the client request
token, Amazon Comprehend generates one.
Parameter dataSecurityConfig :
Data security configurations.
Parameter modelType :
The model type. You need to set ModelType if you are creating
a flywheel for a new model.
Parameter tags :
The tags to associate with this flywheel.
Parameter taskConfig :
Configuration about the model associated with the flywheel. You need to
set TaskConfig if you are creating a flywheel for a new
model.
Implementation
Future<CreateFlywheelResponse> createFlywheel({
required String dataAccessRoleArn,
required String dataLakeS3Uri,
required String flywheelName,
String? activeModelArn,
String? clientRequestToken,
DataSecurityConfig? dataSecurityConfig,
ModelType? modelType,
List<Tag>? tags,
TaskConfig? taskConfig,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'Comprehend_20171127.CreateFlywheel'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'DataAccessRoleArn': dataAccessRoleArn,
'DataLakeS3Uri': dataLakeS3Uri,
'FlywheelName': flywheelName,
if (activeModelArn != null) 'ActiveModelArn': activeModelArn,
'ClientRequestToken':
clientRequestToken ?? _s.generateIdempotencyToken(),
if (dataSecurityConfig != null)
'DataSecurityConfig': dataSecurityConfig,
if (modelType != null) 'ModelType': modelType.value,
if (tags != null) 'Tags': tags,
if (taskConfig != null) 'TaskConfig': taskConfig,
},
);
return CreateFlywheelResponse.fromJson(jsonResponse.body);
}