SageMaker / Client / create_model_monitor_config

create_model_monitor_config

SageMaker.Client.create_model_monitor_config(**kwargs)

Creates a model monitor configuration.

The operation runs synchronously and is idempotent. If you retry the request with the same ClientToken, you get the result of the original request.

Note

This operation is in public preview release for Amazon SageMaker AI and is subject to change. This feature is not recommended for production environments.

See also: AWS API Documentation

Request Syntax

response = client.create_model_monitor_config(
    ModelMonitorConfigName='string',
    MonitoringSource={
        'SageMakerEndpoint': {
            'EndpointName': 'string',
            'VariantName': 'string'
        },
        'BedrockModel': {
            'ModelId': 'string',
            'RequestMetadata': {
                'string': 'string'
            }
        }
    },
    EvaluationConfig={
        'EvalCriteria': {
            'EvalCriteriaArn': 'string',
            'EvalCriteriaVersion': 'string',
            'Sampling': {
                'SamplingPercentage': 123.0,
                'MaxRecords': 123
            }
        },
        'EvalCriteriaList': [
            {
                'EvalCriteriaArn': 'string',
                'EvalCriteriaVersion': 'string',
                'Sampling': {
                    'SamplingPercentage': 123.0,
                    'MaxRecords': 123
                }
            },
        ]
    },
    ScheduleConfig={
        'ScheduleExpression': 'string'
    },
    RoleArn='string',
    Tags=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ],
    ClientToken='string'
)
Parameters:
  • ModelMonitorConfigName (string) –

    [REQUIRED]

    The name of the model monitor configuration.

  • MonitoringSource (dict) –

    [REQUIRED]

    The source that the model monitor configuration monitors.

    Note

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

    • SageMakerEndpoint (dict) –

      A SageMaker AI endpoint to monitor.

      • EndpointName (string) – [REQUIRED]

        The name of the endpoint.

      • VariantName (string) –

        The name of the production variant on the endpoint.

    • BedrockModel (dict) –

      An Amazon Bedrock model to monitor.

      • ModelId (string) – [REQUIRED]

        The ID of the Amazon Bedrock model.

      • RequestMetadata (dict) –

        Limits monitoring to the model invocations that carry these Amazon Bedrock request metadata entries. For more information, see request metadata in the Amazon Bedrock User Guide.

        • (string) –

          An Amazon Bedrock request metadata key.

          • (string) –

            An Amazon Bedrock request metadata value.

  • EvaluationConfig (dict) –

    The evaluation monitoring settings. Specify EvaluationConfig.

    Note

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

    • EvalCriteria (dict) –

      One Eval Criteria and its sampling settings.

      • EvalCriteriaArn (string) – [REQUIRED]

        The Amazon Resource Name (ARN) of the Eval Criteria, a SageMaker AI hub content resource. The ARN can end with a version in the form major.minor.patch.

      • EvalCriteriaVersion (string) –

        The version of the Eval Criteria, in the form major.minor.patch. Each part is 1 to 4 digits.

      • Sampling (dict) – [REQUIRED]

        The sampling settings that every evaluator under the Eval Criteria shares.

        • SamplingPercentage (float) – [REQUIRED]

          The percentage of traces to sample. Valid values are from 0.01 to 100.

        • MaxRecords (integer) –

          The maximum number of records to sample. Valid values are from 1 to 5000.

    • EvalCriteriaList (list) –

      A list of Eval Criteria, each with its own sampling settings.

      • (dict) –

        One Eval Criteria and the sampling settings that every evaluator under it shares.

        • EvalCriteriaArn (string) – [REQUIRED]

          The Amazon Resource Name (ARN) of the Eval Criteria, a SageMaker AI hub content resource. The ARN can end with a version in the form major.minor.patch.

        • EvalCriteriaVersion (string) –

          The version of the Eval Criteria, in the form major.minor.patch. Each part is 1 to 4 digits.

        • Sampling (dict) – [REQUIRED]

          The sampling settings that every evaluator under the Eval Criteria shares.

          • SamplingPercentage (float) – [REQUIRED]

            The percentage of traces to sample. Valid values are from 0.01 to 100.

          • MaxRecords (integer) –

            The maximum number of records to sample. Valid values are from 1 to 5000.

  • ScheduleConfig (dict) –

    [REQUIRED]

    The schedule on which the model monitor configuration runs.

    • ScheduleExpression (string) – [REQUIRED]

      The schedule expression for the model monitor configuration.

  • RoleArn (string) –

    [REQUIRED]

    The Amazon Resource Name (ARN) of the IAM role that the model monitor configuration uses.

  • Tags (list) –

    A list of key-value pairs to apply to the model monitor configuration. For information about tagging, see Tagging Amazon Web Services resources in the Amazon Web Services General Reference.

    • (dict) –

      A tag object that consists of a key and an optional value, used to manage metadata for SageMaker Amazon Web Services resources.

      You can add tags to notebook instances, training jobs, hyperparameter tuning jobs, batch transform jobs, models, labeling jobs, work teams, endpoint configurations, and endpoints. For more information on adding tags to SageMaker resources, see AddTags.

      For more information on adding metadata to your Amazon Web Services resources with tagging, see Tagging Amazon Web Services resources. For advice on best practices for managing Amazon Web Services resources with tagging, see Tagging Best Practices: Implement an Effective Amazon Web Services Resource Tagging Strategy.

      • Key (string) – [REQUIRED]

        The tag key. Tag keys must be unique per resource.

      • Value (string) – [REQUIRED]

        The tag value.

  • ClientToken (string) –

    A unique, case-sensitive identifier that you provide to ensure that the operation completes no more than one time. If you retry a request with the same client token, you get the result of the original request and no error.

    This field is autopopulated if not provided.

Return type:

dict

Returns:

Response Syntax

{
    'ModelMonitorConfigArn': 'string'
}

Response Structure

  • (dict) –

    • ModelMonitorConfigArn (string) –

      The Amazon Resource Name (ARN) of the model monitor configuration.

Exceptions