Amazon Bedrock

2024/08/01 - Amazon Bedrock - 3 new 1 updated api methods

Changes  API and Documentation for Bedrock Model Copy feature. This feature lets you share and copy a custom model from one region to another or one account to another.

ListModelCopyJobs (new) Link ¶

Returns a list of model copy jobs that you have submitted. You can filter the jobs to return based on one or more criteria. For more information, see Copy models to be used in other regions in the Amazon Bedrock User Guide.

See also: AWS API Documentation

Request Syntax

client.list_model_copy_jobs(
    creationTimeAfter=datetime(2015, 1, 1),
    creationTimeBefore=datetime(2015, 1, 1),
    statusEquals='InProgress'|'Completed'|'Failed',
    sourceAccountEquals='string',
    sourceModelArnEquals='string',
    targetModelNameContains='string',
    maxResults=123,
    nextToken='string',
    sortBy='CreationTime',
    sortOrder='Ascending'|'Descending'
)
type creationTimeAfter

datetime

param creationTimeAfter

Filters for model copy jobs created after the specified time.

type creationTimeBefore

datetime

param creationTimeBefore

Filters for model copy jobs created before the specified time.

type statusEquals

string

param statusEquals

Filters for model copy jobs whose status matches the value that you specify.

type sourceAccountEquals

string

param sourceAccountEquals

Filters for model copy jobs in which the account that the source model belongs to is equal to the value that you specify.

type sourceModelArnEquals

string

param sourceModelArnEquals

Filters for model copy jobs in which the Amazon Resource Name (ARN) of the source model to is equal to the value that you specify.

type targetModelNameContains

string

param targetModelNameContains

Filters for model copy jobs in which the name of the copied model contains the string that you specify.

type maxResults

integer

param maxResults

The maximum number of results to return in the response. If the total number of results is greater than this value, use the token returned in the response in the nextToken field when making another request to return the next batch of results.

type nextToken

string

param nextToken

If the total number of results is greater than the maxResults value provided in the request, enter the token returned in the nextToken field in the response in this field to return the next batch of results.

type sortBy

string

param sortBy

The field to sort by in the returned list of model copy jobs.

type sortOrder

string

param sortOrder

Specifies whether to sort the results in ascending or descending order.

rtype

dict

returns

Response Syntax

{
    'nextToken': 'string',
    'modelCopyJobSummaries': [
        {
            'jobArn': 'string',
            'status': 'InProgress'|'Completed'|'Failed',
            'creationTime': datetime(2015, 1, 1),
            'targetModelArn': 'string',
            'targetModelName': 'string',
            'sourceAccountId': 'string',
            'sourceModelArn': 'string',
            'targetModelKmsKeyArn': 'string',
            'targetModelTags': [
                {
                    'key': 'string',
                    'value': 'string'
                },
            ],
            'failureMessage': 'string',
            'sourceModelName': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • nextToken (string) --

      If the total number of results is greater than the maxResults value provided in the request, use this token when making another request in the nextToken field to return the next batch of results.

    • modelCopyJobSummaries (list) --

      A list of information about each model copy job.

      • (dict) --

        Contains details about each model copy job.

        This data type is used in the following API operations:

        • jobArn (string) --

          The Amazon Resoource Name (ARN) of the model copy job.

        • status (string) --

          The status of the model copy job.

        • creationTime (datetime) --

          The time that the model copy job was created.

        • targetModelArn (string) --

          The Amazon Resource Name (ARN) of the copied model.

        • targetModelName (string) --

          The name of the copied model.

        • sourceAccountId (string) --

          The unique identifier of the account that the model being copied originated from.

        • sourceModelArn (string) --

          The Amazon Resource Name (ARN) of the original model being copied.

        • targetModelKmsKeyArn (string) --

          The Amazon Resource Name (ARN) of the KMS key used to encrypt the copied model.

        • targetModelTags (list) --

          Tags associated with the copied model.

          • (dict) --

            Definition of the key/value pair for a tag.

            • key (string) --

              Key for the tag.

            • value (string) --

              Value for the tag.

        • failureMessage (string) --

          If a model fails to be copied, a message describing why the job failed is included here.

        • sourceModelName (string) --

          The name of the original model being copied.

CreateModelCopyJob (new) Link ¶

Copies a model to another region so that it can be used there. For more information, see Copy models to be used in other regions in the Amazon Bedrock User Guide.

See also: AWS API Documentation

Request Syntax

client.create_model_copy_job(
    sourceModelArn='string',
    targetModelName='string',
    modelKmsKeyId='string',
    targetModelTags=[
        {
            'key': 'string',
            'value': 'string'
        },
    ],
    clientRequestToken='string'
)
type sourceModelArn

string

param sourceModelArn

[REQUIRED]

The Amazon Resource Name (ARN) of the model to be copied.

type targetModelName

string

param targetModelName

[REQUIRED]

A name for the copied model.

type modelKmsKeyId

string

param modelKmsKeyId

The ARN of the KMS key that you use to encrypt the model copy.

type targetModelTags

list

param targetModelTags

Tags to associate with the target model. For more information, see Tag resources in the Amazon Bedrock User Guide.

  • (dict) --

    Definition of the key/value pair for a tag.

    • key (string) -- [REQUIRED]

      Key for the tag.

    • value (string) -- [REQUIRED]

      Value for the tag.

type clientRequestToken

string

param clientRequestToken

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.

rtype

dict

returns

Response Syntax

{
    'jobArn': 'string'
}

Response Structure

  • (dict) --

    • jobArn (string) --

      The Amazon Resource Name (ARN) of the model copy job.

GetModelCopyJob (new) Link ¶

Retrieves information about a model copy job. For more information, see Copy models to be used in other regions in the Amazon Bedrock User Guide.

See also: AWS API Documentation

Request Syntax

client.get_model_copy_job(
    jobArn='string'
)
type jobArn

string

param jobArn

[REQUIRED]

The Amazon Resource Name (ARN) of the model copy job.

rtype

dict

returns

Response Syntax

{
    'jobArn': 'string',
    'status': 'InProgress'|'Completed'|'Failed',
    'creationTime': datetime(2015, 1, 1),
    'targetModelArn': 'string',
    'targetModelName': 'string',
    'sourceAccountId': 'string',
    'sourceModelArn': 'string',
    'targetModelKmsKeyArn': 'string',
    'targetModelTags': [
        {
            'key': 'string',
            'value': 'string'
        },
    ],
    'failureMessage': 'string',
    'sourceModelName': 'string'
}

Response Structure

  • (dict) --

    • jobArn (string) --

      The Amazon Resource Name (ARN) of the model copy job.

    • status (string) --

      The status of the model copy job.

    • creationTime (datetime) --

      The time at which the model copy job was created.

    • targetModelArn (string) --

      The Amazon Resource Name (ARN) of the copied model.

    • targetModelName (string) --

      The name of the copied model.

    • sourceAccountId (string) --

      The unique identifier of the account that the model being copied originated from.

    • sourceModelArn (string) --

      The Amazon Resource Name (ARN) of the original model being copied.

    • targetModelKmsKeyArn (string) --

      The Amazon Resource Name (ARN) of the KMS key encrypting the copied model.

    • targetModelTags (list) --

      The tags associated with the copied model.

      • (dict) --

        Definition of the key/value pair for a tag.

        • key (string) --

          Key for the tag.

        • value (string) --

          Value for the tag.

    • failureMessage (string) --

      An error message for why the model copy job failed.

    • sourceModelName (string) --

      The name of the original model being copied.

ListCustomModels (updated) Link ¶
Changes (request, response)
Request
{'isOwned': 'boolean'}
Response
{'modelSummaries': {'ownerAccountId': 'string'}}

Returns a list of the custom models that you have created with the CreateModelCustomizationJob operation.

For more information, see Custom models in the Amazon Bedrock User Guide.

See also: AWS API Documentation

Request Syntax

client.list_custom_models(
    creationTimeBefore=datetime(2015, 1, 1),
    creationTimeAfter=datetime(2015, 1, 1),
    nameContains='string',
    baseModelArnEquals='string',
    foundationModelArnEquals='string',
    maxResults=123,
    nextToken='string',
    sortBy='CreationTime',
    sortOrder='Ascending'|'Descending',
    isOwned=True|False
)
type creationTimeBefore

datetime

param creationTimeBefore

Return custom models created before the specified time.

type creationTimeAfter

datetime

param creationTimeAfter

Return custom models created after the specified time.

type nameContains

string

param nameContains

Return custom models only if the job name contains these characters.

type baseModelArnEquals

string

param baseModelArnEquals

Return custom models only if the base model Amazon Resource Name (ARN) matches this parameter.

type foundationModelArnEquals

string

param foundationModelArnEquals

Return custom models only if the foundation model Amazon Resource Name (ARN) matches this parameter.

type maxResults

integer

param maxResults

The maximum number of results to return in the response. If the total number of results is greater than this value, use the token returned in the response in the nextToken field when making another request to return the next batch of results.

type nextToken

string

param nextToken

If the total number of results is greater than the maxResults value provided in the request, enter the token returned in the nextToken field in the response in this field to return the next batch of results.

type sortBy

string

param sortBy

The field to sort by in the returned list of models.

type sortOrder

string

param sortOrder

The sort order of the results.

type isOwned

boolean

param isOwned

Return custom models depending on if the current account owns them ( true ) or if they were shared with the current account ( false ).

rtype

dict

returns

Response Syntax

{
    'nextToken': 'string',
    'modelSummaries': [
        {
            'modelArn': 'string',
            'modelName': 'string',
            'creationTime': datetime(2015, 1, 1),
            'baseModelArn': 'string',
            'baseModelName': 'string',
            'customizationType': 'FINE_TUNING'|'CONTINUED_PRE_TRAINING',
            'ownerAccountId': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • nextToken (string) --

      If the total number of results is greater than the maxResults value provided in the request, use this token when making another request in the nextToken field to return the next batch of results.

    • modelSummaries (list) --

      Model summaries.

      • (dict) --

        Summary information for a custom model.

        • modelArn (string) --

          The Amazon Resource Name (ARN) of the custom model.

        • modelName (string) --

          The name of the custom model.

        • creationTime (datetime) --

          Creation time of the model.

        • baseModelArn (string) --

          The base model Amazon Resource Name (ARN).

        • baseModelName (string) --

          The base model name.

        • customizationType (string) --

          Specifies whether to carry out continued pre-training of a model or whether to fine-tune it. For more information, see Custom models.

        • ownerAccountId (string) --

          The unique identifier of the account that owns the model.