Amazon Bedrock

2026/05/14 - Amazon Bedrock - 5 new api methods

Changes  Advanced Prompt Optimization (AdvPO) allows you to optimize and migrate your prompts for any model on Bedrock by automatically evaluating responses and rewriting prompts to improve performance. This release provides a programmatic way to create, get, list, stop, and delete AdvPO jobs.

CreateAdvancedPromptOptimizationJob (new) Link ¶

Creates an asynchronous batch job for advanced prompt optimization.

See also: AWS API Documentation

Request Syntax

client.create_advanced_prompt_optimization_job(
    jobName='string',
    jobDescription='string',
    clientToken='string',
    inputConfig={
        's3Uri': 'string'
    },
    outputConfig={
        's3Uri': 'string'
    },
    encryptionKeyArn='string',
    tags=[
        {
            'key': 'string',
            'value': 'string'
        },
    ],
    modelConfigurations=[
        {
            'modelId': 'string',
            'inferenceConfig': {
                'maxTokens': 123,
                'temperature': ...,
                'topP': ...,
                'stopSequences': [
                    'string',
                ]
            },
            'additionalModelRequestFields': {
                'string': {...}|[...]|123|123.4|'string'|True|None
            }
        },
    ]
)
type jobName:

string

param jobName:

[REQUIRED]

Name of the advanced prompt optimization job.

type jobDescription:

string

param jobDescription:

Description of the advanced prompt optimization job.

type clientToken:

string

param clientToken:

Idempotency token for the request.

This field is autopopulated if not provided.

type inputConfig:

dict

param inputConfig:

[REQUIRED]

Input data configuration for the advanced prompt optimization job.

  • s3Uri (string) -- [REQUIRED]

    S3 URI of the input JSONL file.

type outputConfig:

dict

param outputConfig:

[REQUIRED]

Output data configuration for the advanced prompt optimization job.

  • s3Uri (string) -- [REQUIRED]

    S3 URI prefix for the output location.

type encryptionKeyArn:

string

param encryptionKeyArn:

KMS key ARN for encrypting output data.

type tags:

list

param tags:

Tags to associate with the 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.

type modelConfigurations:

list

param modelConfigurations:

[REQUIRED]

Model configurations for advanced prompt optimization.

  • (dict) --

    Configuration for a model used in advanced prompt optimization.

    • modelId (string) -- [REQUIRED]

      The model ID.

    • inferenceConfig (dict) --

      Inference configuration for the model.

      • maxTokens (integer) --

        The maximum number of tokens to generate.

      • temperature (float) --

        The temperature for sampling.

      • topP (float) --

        The top-p value for nucleus sampling.

      • stopSequences (list) --

        Stop sequences that end generation.

        • (string) --

    • additionalModelRequestFields (dict) --

      Additional model request fields.

      • (string) --

        • (:ref:`document<document>`) --

rtype:

dict

returns:

Response Syntax

{
    'jobArn': 'string'
}

Response Structure

  • (dict) --

    Create Advanced Prompt Optimization Job Response

    • jobArn (string) --

      ARN of the created advanced prompt optimization job.

BatchDeleteAdvancedPromptOptimizationJob (new) Link ¶

Batch delete the specified advanced prompt optimization jobs.

See also: AWS API Documentation

Request Syntax

client.batch_delete_advanced_prompt_optimization_job(
    jobIdentifiers=[
        'string',
    ]
)
type jobIdentifiers:

list

param jobIdentifiers:

[REQUIRED]

List of advanced prompt optimization job identifiers to delete.

  • (string) --

    ARN or ID of the advanced prompt optimization job.

rtype:

dict

returns:

Response Syntax

{
    'errors': [
        {
            'jobIdentifier': 'string',
            'code': 'string',
            'message': 'string'
        },
    ],
    'advancedPromptOptimizationJobs': [
        {
            'jobIdentifier': 'string',
            'jobStatus': 'InProgress'|'Completed'|'Failed'|'PartiallyCompleted'|'Stopping'|'Stopped'|'Deleting'
        },
    ]
}

Response Structure

  • (dict) --

    Batch Delete Advanced Prompt Optimization Jobs Response

    • errors (list) --

      List of errors encountered during batch deletion.

      • (dict) --

        Batch deletion error for an advanced prompt optimization job.

        • jobIdentifier (string) --

          Identifier of the job that failed to delete.

        • code (string) --

          Error code for the deletion failure.

        • message (string) --

          Error message describing the deletion failure.

    • advancedPromptOptimizationJobs (list) --

      List of successfully deleted advanced prompt optimization jobs.

      • (dict) --

        Successfully deleted advanced prompt optimization job.

        • jobIdentifier (string) --

          Identifier of the deleted job.

        • jobStatus (string) --

          Status of the deleted job.

StopAdvancedPromptOptimizationJob (new) Link ¶

Stops an in-progress advanced prompt optimization job.

See also: AWS API Documentation

Request Syntax

client.stop_advanced_prompt_optimization_job(
    jobIdentifier='string'
)
type jobIdentifier:

string

param jobIdentifier:

[REQUIRED]

ARN or ID of the advanced prompt optimization job to stop.

rtype:

dict

returns:

Response Syntax

{}

Response Structure

  • (dict) --

    Stop Advanced Prompt Optimization Job Response

GetAdvancedPromptOptimizationJob (new) Link ¶

Retrieves the details and status of an advanced prompt optimization job.

See also: AWS API Documentation

Request Syntax

client.get_advanced_prompt_optimization_job(
    jobIdentifier='string'
)
type jobIdentifier:

string

param jobIdentifier:

[REQUIRED]

ARN or ID of the advanced prompt optimization job.

rtype:

dict

returns:

Response Syntax

{
    'jobArn': 'string',
    'jobName': 'string',
    'jobDescription': 'string',
    'jobStatus': 'InProgress'|'Completed'|'Failed'|'PartiallyCompleted'|'Stopping'|'Stopped'|'Deleting',
    'inputConfig': {
        's3Uri': 'string'
    },
    'outputConfig': {
        's3Uri': 'string'
    },
    'encryptionKeyArn': 'string',
    'creationTime': datetime(2015, 1, 1),
    'lastModifiedTime': datetime(2015, 1, 1),
    'failureMessage': 'string',
    'modelConfigurations': [
        {
            'modelId': 'string',
            'inferenceConfig': {
                'maxTokens': 123,
                'temperature': ...,
                'topP': ...,
                'stopSequences': [
                    'string',
                ]
            },
            'additionalModelRequestFields': {
                'string': {...}|[...]|123|123.4|'string'|True|None
            }
        },
    ]
}

Response Structure

  • (dict) --

    Get Advanced Prompt Optimization Job Response

    • jobArn (string) --

      ARN of the advanced prompt optimization job.

    • jobName (string) --

      Name of the advanced prompt optimization job.

    • jobDescription (string) --

      Description of the advanced prompt optimization job.

    • jobStatus (string) --

      Status of the advanced prompt optimization job.

    • inputConfig (dict) --

      Input data configuration for the advanced prompt optimization job.

      • s3Uri (string) --

        S3 URI of the input JSONL file.

    • outputConfig (dict) --

      Output data configuration for the advanced prompt optimization job.

      • s3Uri (string) --

        S3 URI prefix for the output location.

    • encryptionKeyArn (string) --

      KMS key ARN used for encrypting output data.

    • creationTime (datetime) --

      Creation time of the advanced prompt optimization job.

    • lastModifiedTime (datetime) --

      Last modified time of the advanced prompt optimization job.

    • failureMessage (string) --

      Failure message if the advanced prompt optimization job failed.

    • modelConfigurations (list) --

      Model configurations for advanced prompt optimization.

      • (dict) --

        Configuration for a model used in advanced prompt optimization.

        • modelId (string) --

          The model ID.

        • inferenceConfig (dict) --

          Inference configuration for the model.

          • maxTokens (integer) --

            The maximum number of tokens to generate.

          • temperature (float) --

            The temperature for sampling.

          • topP (float) --

            The top-p value for nucleus sampling.

          • stopSequences (list) --

            Stop sequences that end generation.

            • (string) --

        • additionalModelRequestFields (dict) --

          Additional model request fields.

          • (string) --

            • (:ref:`document<document>`) --

ListAdvancedPromptOptimizationJobs (new) Link ¶

Lists all advanced prompt optimization jobs for the account.

See also: AWS API Documentation

Request Syntax

client.list_advanced_prompt_optimization_jobs(
    maxResults=123,
    nextToken='string',
    sortBy='CreationTime',
    sortOrder='Ascending'|'Descending'
)
type maxResults:

integer

param maxResults:

Maximum number of results to return.

type nextToken:

string

param nextToken:

Pagination token for the next page of results.

type sortBy:

string

param sortBy:

Field to sort by in the returned list of jobs.

type sortOrder:

string

param sortOrder:

Sort order for the results.

rtype:

dict

returns:

Response Syntax

{
    'jobSummaries': [
        {
            'jobArn': 'string',
            'jobName': 'string',
            'jobStatus': 'InProgress'|'Completed'|'Failed'|'PartiallyCompleted'|'Stopping'|'Stopped'|'Deleting',
            'creationTime': datetime(2015, 1, 1),
            'lastModifiedTime': datetime(2015, 1, 1)
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    List Advanced Prompt Optimization Jobs Response

    • jobSummaries (list) --

      List of advanced prompt optimization job summaries.

      • (dict) --

        Summary of an advanced prompt optimization job.

        • jobArn (string) --

          ARN of the advanced prompt optimization job.

        • jobName (string) --

          Name of the advanced prompt optimization job.

        • jobStatus (string) --

          Status of the advanced prompt optimization job.

        • creationTime (datetime) --

          Creation time of the advanced prompt optimization job.

        • lastModifiedTime (datetime) --

          Last modified time of the advanced prompt optimization job.

    • nextToken (string) --

      Pagination token for the next page of results.