Bedrock / Client / create_evaluation_job

create_evaluation_job#

Bedrock.Client.create_evaluation_job(**kwargs)#

API operation for creating and managing Amazon Bedrock automatic model evaluation jobs and model evaluation jobs that use human workers. To learn more about the requirements for creating a model evaluation job see, Model evaluations.

See also: AWS API Documentation

Request Syntax

response = client.create_evaluation_job(
    jobName='string',
    jobDescription='string',
    clientRequestToken='string',
    roleArn='string',
    customerEncryptionKeyId='string',
    jobTags=[
        {
            'key': 'string',
            'value': 'string'
        },
    ],
    evaluationConfig={
        'automated': {
            'datasetMetricConfigs': [
                {
                    'taskType': 'Summarization'|'Classification'|'QuestionAndAnswer'|'Generation'|'Custom',
                    'dataset': {
                        'name': 'string',
                        'datasetLocation': {
                            's3Uri': 'string'
                        }
                    },
                    'metricNames': [
                        'string',
                    ]
                },
            ]
        },
        'human': {
            'humanWorkflowConfig': {
                'flowDefinitionArn': 'string',
                'instructions': 'string'
            },
            'customMetrics': [
                {
                    'name': 'string',
                    'description': 'string',
                    'ratingMethod': 'string'
                },
            ],
            'datasetMetricConfigs': [
                {
                    'taskType': 'Summarization'|'Classification'|'QuestionAndAnswer'|'Generation'|'Custom',
                    'dataset': {
                        'name': 'string',
                        'datasetLocation': {
                            's3Uri': 'string'
                        }
                    },
                    'metricNames': [
                        'string',
                    ]
                },
            ]
        }
    },
    inferenceConfig={
        'models': [
            {
                'bedrockModel': {
                    'modelIdentifier': 'string',
                    'inferenceParams': 'string'
                }
            },
        ]
    },
    outputDataConfig={
        's3Uri': 'string'
    }
)
Parameters:
  • jobName (string) –

    [REQUIRED]

    The name of the model evaluation job. Model evaluation job names must unique with your AWS account, and your account’s AWS region.

  • jobDescription (string) – A description of the model evaluation job.

  • clientRequestToken (string) –

    A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error. For more information, see Ensuring idempotency.

    This field is autopopulated if not provided.

  • roleArn (string) –

    [REQUIRED]

    The Amazon Resource Name (ARN) of an IAM service role that Amazon Bedrock can assume to perform tasks on your behalf. The service role must have Amazon Bedrock as the service principal, and provide access to any Amazon S3 buckets specified in the EvaluationConfig object. To pass this role to Amazon Bedrock, the caller of this API must have the iam:PassRole permission. To learn more about the required permissions, see Required permissions.

  • customerEncryptionKeyId (string) – Specify your customer managed key ARN that will be used to encrypt your model evaluation job.

  • jobTags (list) –

    Tags to attach to the model evaluation job.

    • (dict) –

      Definition of the key/value pair for a tag.

      • key (string) – [REQUIRED]

        Key for the tag.

      • value (string) – [REQUIRED]

        Value for the tag.

  • evaluationConfig (dict) –

    [REQUIRED]

    Specifies whether the model evaluation job is automatic or uses human worker.

    Note

    This is a Tagged Union structure. Only one of the following top level keys can be set: automated, human.

    • automated (dict) –

      Used to specify an automated model evaluation job. See AutomatedEvaluationConfig to view the required parameters.

      • datasetMetricConfigs (list) – [REQUIRED]

        Specifies the required elements for an automatic model evaluation job.

        • (dict) –

          Defines the built-in prompt datasets, built-in metric names and custom metric names, and the task type.

          • taskType (string) – [REQUIRED]

            The task type you want the model to carry out.

          • dataset (dict) – [REQUIRED]

            Specifies the prompt dataset.

            • name (string) – [REQUIRED]

              Used to specify supported built-in prompt datasets. Valid values are Builtin.Bold, Builtin.BoolQ, Builtin.NaturalQuestions, Builtin.Gigaword, Builtin.RealToxicityPrompts, Builtin.TriviaQa, Builtin.T-Rex, Builtin.WomensEcommerceClothingReviews and Builtin.Wikitext2.

            • datasetLocation (dict) –

              For custom prompt datasets, you must specify the location in Amazon S3 where the prompt dataset is saved.

              Note

              This is a Tagged Union structure. Only one of the following top level keys can be set: s3Uri.

              • s3Uri (string) –

                The S3 URI of the S3 bucket specified in the job.

          • metricNames (list) – [REQUIRED]

            The names of the metrics used. For automated model evaluation jobs valid values are "Builtin.Accuracy", "Builtin.Robustness", and "Builtin.Toxicity". In human-based model evaluation jobs the array of strings must match the name parameter specified in HumanEvaluationCustomMetric.

            • (string) –

    • human (dict) –

      Used to specify a model evaluation job that uses human workers.See HumanEvaluationConfig to view the required parameters.

      • humanWorkflowConfig (dict) –

        The parameters of the human workflow.

        • flowDefinitionArn (string) – [REQUIRED]

          The Amazon Resource Number (ARN) for the flow definition

        • instructions (string) –

          Instructions for the flow definition

      • customMetrics (list) –

        A HumanEvaluationCustomMetric object. It contains the names the metrics, how the metrics are to be evaluated, an optional description.

        • (dict) –

          In a model evaluation job that uses human workers you must define the name of the metric, and how you want that metric rated ratingMethod, and an optional description of the metric.

          • name (string) – [REQUIRED]

            The name of the metric. Your human evaluators will see this name in the evaluation UI.

          • description (string) –

            An optional description of the metric. Use this parameter to provide more details about the metric.

          • ratingMethod (string) – [REQUIRED]

            Choose how you want your human workers to evaluation your model. Valid values for rating methods are ThumbsUpDown, IndividualLikertScale, ComparisonLikertScale, ComparisonChoice, and ComparisonRank

      • datasetMetricConfigs (list) – [REQUIRED]

        Use to specify the metrics, task, and prompt dataset to be used in your model evaluation job.

        • (dict) –

          Defines the built-in prompt datasets, built-in metric names and custom metric names, and the task type.

          • taskType (string) – [REQUIRED]

            The task type you want the model to carry out.

          • dataset (dict) – [REQUIRED]

            Specifies the prompt dataset.

            • name (string) – [REQUIRED]

              Used to specify supported built-in prompt datasets. Valid values are Builtin.Bold, Builtin.BoolQ, Builtin.NaturalQuestions, Builtin.Gigaword, Builtin.RealToxicityPrompts, Builtin.TriviaQa, Builtin.T-Rex, Builtin.WomensEcommerceClothingReviews and Builtin.Wikitext2.

            • datasetLocation (dict) –

              For custom prompt datasets, you must specify the location in Amazon S3 where the prompt dataset is saved.

              Note

              This is a Tagged Union structure. Only one of the following top level keys can be set: s3Uri.

              • s3Uri (string) –

                The S3 URI of the S3 bucket specified in the job.

          • metricNames (list) – [REQUIRED]

            The names of the metrics used. For automated model evaluation jobs valid values are "Builtin.Accuracy", "Builtin.Robustness", and "Builtin.Toxicity". In human-based model evaluation jobs the array of strings must match the name parameter specified in HumanEvaluationCustomMetric.

            • (string) –

  • inferenceConfig (dict) –

    [REQUIRED]

    Specify the models you want to use in your model evaluation job. Automatic model evaluation jobs support a single model, and model evaluation job that use human workers support two models.

    Note

    This is a Tagged Union structure. Only one of the following top level keys can be set: models.

    • models (list) –

      Used to specify the models.

      • (dict) –

        Defines the models used in the model evaluation job.

        Note

        This is a Tagged Union structure. Only one of the following top level keys can be set: bedrockModel.

        • bedrockModel (dict) –

          Defines the Amazon Bedrock model and inference parameters you want used.

          • modelIdentifier (string) – [REQUIRED]

            The ARN of the Amazon Bedrock model specified.

          • inferenceParams (string) – [REQUIRED]

            Each Amazon Bedrock support different inference parameters that change how the model behaves during inference.

  • outputDataConfig (dict) –

    [REQUIRED]

    An object that defines where the results of model evaluation job will be saved in Amazon S3.

    • s3Uri (string) – [REQUIRED]

      The Amazon S3 URI where the results of model evaluation job are saved.

Return type:

dict

Returns:

Response Syntax

{
    'jobArn': 'string'
}

Response Structure

  • (dict) –

    • jobArn (string) –

      The ARN of the model evaluation job.

Exceptions

  • Bedrock.Client.exceptions.ResourceNotFoundException

  • Bedrock.Client.exceptions.AccessDeniedException

  • Bedrock.Client.exceptions.ValidationException

  • Bedrock.Client.exceptions.ConflictException

  • Bedrock.Client.exceptions.InternalServerException

  • Bedrock.Client.exceptions.ServiceQuotaExceededException

  • Bedrock.Client.exceptions.ThrottlingException