createJob method
Creates a model customization job in Amazon SageMaker. A job runs a workload based on the job category and configuration you provide. You specify the job category, a schema-versioned configuration document, and an IAM role that grants Amazon SageMaker permission to access resources on your behalf.
Use the AgentRFT category to fine-tune a model using
multi-turn reinforcement learning with reward signals. Use the
AgentRFTEvaluation category to evaluate a fine-tuned or base
model by running multi-turn rollouts against a held-out prompt dataset and
computing metrics such as pass@k and mean reward.
Before creating a job, call ListJobSchemaVersions and
DescribeJobSchemaVersion to retrieve the configuration schema
for your job category. The JobConfigDocument must conform to
the schema specified by JobConfigSchemaVersion.
The following operations are related to CreateJob:
-
DescribeJob -
ListJobs -
StopJob -
DeleteJob -
ListJobSchemaVersions -
DescribeJobSchemaVersion
May throw ResourceInUse.
May throw ResourceLimitExceeded.
May throw ResourceNotFound.
Parameter jobCategory :
The category of the job. The category determines the type of workload that
the job runs.
Parameter jobConfigDocument :
The JSON configuration document for the job. The document must conform to
the schema specified by JobConfigSchemaVersion. Use
DescribeJobSchemaVersion to retrieve the schema for
validation.
Parameter jobConfigSchemaVersion :
The version of the configuration schema to use for the job configuration
document. Use ListJobSchemaVersions to get available schema
versions for a job category.
Parameter jobName :
The name of the job. The name must be unique within your account and
Amazon Web Services Region.
Parameter roleArn :
The Amazon Resource Name (ARN) of the IAM role that Amazon SageMaker
assumes to perform the job. The role must have the necessary permissions
to access the resources required by the job configuration.
Parameter tags :
An array of key-value pairs to apply to the job as tags. For more
information, see Tagging
Amazon Web Services Resources.
Implementation
Future<CreateJobResponse> createJob({
required JobCategory jobCategory,
required String jobConfigDocument,
required String jobConfigSchemaVersion,
required String jobName,
required String roleArn,
List<Tag>? tags,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'SageMaker.CreateJob'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'JobCategory': jobCategory.value,
'JobConfigDocument': jobConfigDocument,
'JobConfigSchemaVersion': jobConfigSchemaVersion,
'JobName': jobName,
'RoleArn': roleArn,
if (tags != null) 'Tags': tags,
},
);
return CreateJobResponse.fromJson(jsonResponse.body);
}