Skip to content

create_evaluation_job async

create_evaluation_job(
    job_name: EvaluationJobName,
    role_arn: RoleArn,
    evaluation_config: EvaluationConfig,
    inference_config: EvaluationInferenceConfig,
    output_data_config: EvaluationOutputDataConfig,
    *,
    config_overrides: Optional[AsyncBedrockClientConfig] = None,
    job_description: Optional[EvaluationJobDescription] = None,
    client_request_token: Optional[IdempotencyToken] = None,
    customer_encryption_key_id: Optional[KmsKeyId] = None,
    job_tags: Optional[TagList] = None,
    application_type: Optional[ApplicationType] = None,
) -> CreateEvaluationJobResponse

Creates an evaluation job.

Parameters:

  • job_name (EvaluationJobName) –

    A name for the evaluation job. Names must unique with your Amazon Web Services account, and your account's Amazon Web Services region.

  • job_description (Optional[EvaluationJobDescription], default: None ) –

    A description of the evaluation job.

  • client_request_token (Optional[IdempotencyToken], default: None ) –

    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.

  • role_arn (RoleArn) –

    The Amazon Resource Name (ARN) of an IAM service role that Amazon Bedrock can assume to perform tasks on your behalf. To learn more about the required permissions, see Required permissions for model evaluations.

  • customer_encryption_key_id (Optional[KmsKeyId], default: None ) –

    Specify your customer managed encryption key Amazon Resource Name (ARN) that will be used to encrypt your evaluation job.

  • job_tags (Optional[TagList], default: None ) –

    Tags to attach to the model evaluation job.

  • application_type (Optional[ApplicationType], default: None ) –

    Specifies whether the evaluation job is for evaluating a model or evaluating a knowledge base (retrieval and response generation).

  • evaluation_config (EvaluationConfig) –

    Contains the configuration details of either an automated or human-based evaluation job.

  • inference_config (EvaluationInferenceConfig) –

    Contains the configuration details of the inference model for the evaluation job.

    For model evaluation jobs, automated jobs support a single model or inference profile, and jobs that use human workers support two models or inference profiles.

  • output_data_config (EvaluationOutputDataConfig) –

    Contains the configuration details of the Amazon S3 bucket for storing the results of the evaluation job.

Raises:

Source code in docs_src/capo_bedrock/_services/async_bedrock.py
async def create_evaluation_job(
    self,
    job_name: "capo_bedrock.types.evaluation_job_name.EvaluationJobName",
    role_arn: "capo_bedrock.types.role_arn.RoleArn",
    evaluation_config: "capo_bedrock.types.evaluation_config.EvaluationConfig",
    inference_config: "capo_bedrock.types.evaluation_inference_config.EvaluationInferenceConfig",
    output_data_config: "capo_bedrock.types.evaluation_output_data_config.EvaluationOutputDataConfig",
    *,
    config_overrides: Optional[AsyncBedrockClientConfig] = None,
    job_description: Optional[
        "capo_bedrock.types.evaluation_job_description.EvaluationJobDescription"
    ] = None,
    client_request_token: Optional[
        "capo_bedrock.types.idempotency_token.IdempotencyToken"
    ] = None,
    customer_encryption_key_id: Optional[
        "capo_bedrock.types.kms_key_id.KmsKeyId"
    ] = None,
    job_tags: Optional["capo_bedrock.types.tag_list.TagList"] = None,
    application_type: Optional[
        "capo_bedrock.types.application_type.ApplicationType"
    ] = None,
) -> (
    "capo_bedrock.types.create_evaluation_job_response.CreateEvaluationJobResponse"
):
    """<p>Creates an evaluation job.</p>

    Args:
        job_name: <p>A name for the evaluation job. Names must unique with your Amazon Web Services account, and your account's Amazon Web Services region.</p>
        job_description: <p>A description of the evaluation job.</p>
        client_request_token: <p>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 <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html">Ensuring idempotency</a>.</p>
        role_arn: <p>The Amazon Resource Name (ARN) of an IAM service role that Amazon Bedrock can assume to perform tasks on your behalf. To learn more about the required permissions, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-evaluation-security.html">Required permissions for model evaluations</a>.</p>
        customer_encryption_key_id: <p>Specify your customer managed encryption key Amazon Resource Name (ARN) that will be used to encrypt your evaluation job.</p>
        job_tags: <p>Tags to attach to the model evaluation job.</p>
        application_type: <p>Specifies whether the evaluation job is for evaluating a model or evaluating a knowledge base (retrieval and response generation).</p>
        evaluation_config: <p>Contains the configuration details of either an automated or human-based evaluation job.</p>
        inference_config: <p>Contains the configuration details of the inference model for the evaluation job.</p> <p>For model evaluation jobs, automated jobs support a single model or <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/cross-region-inference.html">inference profile</a>, and jobs that use human workers support two models or inference profiles.</p>
        output_data_config: <p>Contains the configuration details of the Amazon S3 bucket for storing the results of the evaluation job.</p>

    Raises:
        capo_bedrock.errors.access_denied_exception.AccessDeniedException: <p>The request is denied because of missing access permissions.</p>
        capo_bedrock.errors.conflict_exception.ConflictException: <p>Error occurred because of a conflict while performing an operation.</p>
        capo_bedrock.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry your request.</p>
        capo_bedrock.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.</p>
        capo_bedrock.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The number of requests exceeds the service quota. Resubmit your request later.</p>
        capo_bedrock.errors.throttling_exception.ThrottlingException: <p>The number of requests exceeds the limit. Resubmit your request later.</p>
        capo_bedrock.errors.validation_exception.ValidationException: <p>Input validation failed. Check your request parameters and retry the request.</p>
        capo_bedrock.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_bedrock.types.create_evaluation_job_request.CreateEvaluationJobRequest]",
    ) -> AsyncOperationResponse[
        "capo_bedrock.types.create_evaluation_job_response.CreateEvaluationJobResponse"
    ]:
        import capo_bedrock._operations.amazon_bedrock_control_plane_service.create_evaluation_job

        (
            output,
            http_response,
        ) = await capo_bedrock._operations.amazon_bedrock_control_plane_service.create_evaluation_job.async_create_evaluation_job(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_bedrock.types.create_evaluation_job_request.CreateEvaluationJobRequest",
    ) -> dict[str, Any]:
        import capo_bedrock.types.create_evaluation_job_request

        return capo_bedrock.types.create_evaluation_job_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateEvaluationJob", redact_input=_redact_input),
    )
    input_: capo_bedrock.types.create_evaluation_job_request.CreateEvaluationJobRequest = {
        "job_name": job_name,
        "role_arn": role_arn,
        "evaluation_config": evaluation_config,
        "inference_config": inference_config,
        "output_data_config": output_data_config,
    }
    if job_description is not None:
        input_["job_description"] = job_description
    if client_request_token is None:
        client_request_token = str(uuid.uuid4())
    input_["client_request_token"] = client_request_token
    if customer_encryption_key_id is not None:
        input_["customer_encryption_key_id"] = customer_encryption_key_id
    if job_tags is not None:
        input_["job_tags"] = job_tags
    if application_type is not None:
        input_["application_type"] = application_type

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output