Amazon Bedrock

2025/03/06 - Amazon Bedrock - 2 new1 updated api methods

Changes  This releases adds support for Custom Prompt Router

CreatePromptRouter (new) Link ¶

Creates a prompt router that manages the routing of requests between multiple foundation models based on the routing criteria.

See also: AWS API Documentation

Request Syntax

client.create_prompt_router(
    clientRequestToken='string',
    promptRouterName='string',
    models=[
        {
            'modelArn': 'string'
        },
    ],
    description='string',
    routingCriteria={
        'responseQualityDifference': 123.0
    },
    fallbackModel={
        'modelArn': 'string'
    },
    tags=[
        {
            'key': 'string',
            'value': 'string'
        },
    ]
)
type clientRequestToken:

string

param clientRequestToken:

A unique, case-sensitive identifier that you provide to ensure idempotency of your requests. If not specified, the Amazon Web Services SDK automatically generates one for you.

This field is autopopulated if not provided.

type promptRouterName:

string

param promptRouterName:

[REQUIRED]

The name of the prompt router. The name must be unique within your Amazon Web Services account in the current region.

type models:

list

param models:

[REQUIRED]

A list of foundation models that the prompt router can route requests to. At least one model must be specified.

  • (dict) --

    The target model for a prompt router.

    • modelArn (string) -- [REQUIRED]

      The target model's ARN.

type description:

string

param description:

An optional description of the prompt router to help identify its purpose.

type routingCriteria:

dict

param routingCriteria:

[REQUIRED]

The criteria, which is the response quality difference, used to determine how incoming requests are routed to different models.

  • responseQualityDifference (float) -- [REQUIRED]

    The criteria's response quality difference.

type fallbackModel:

dict

param fallbackModel:

[REQUIRED]

The default model to use when the routing criteria is not met.

  • modelArn (string) -- [REQUIRED]

    The target model's ARN.

type tags:

list

param tags:

An array of key-value pairs to apply to this resource as tags. You can use tags to categorize and manage your Amazon Web Services resources.

  • (dict) --

    Definition of the key/value pair for a tag.

    • key (string) -- [REQUIRED]

      Key for the tag.

    • value (string) -- [REQUIRED]

      Value for the tag.

rtype:

dict

returns:

Response Syntax

{
    'promptRouterArn': 'string'
}

Response Structure

  • (dict) --

    • promptRouterArn (string) --

      The Amazon Resource Name (ARN) that uniquely identifies the prompt router.

DeletePromptRouter (new) Link ¶

Deletes a specified prompt router. This action cannot be undone.

See also: AWS API Documentation

Request Syntax

client.delete_prompt_router(
    promptRouterArn='string'
)
type promptRouterArn:

string

param promptRouterArn:

[REQUIRED]

The Amazon Resource Name (ARN) of the prompt router to delete.

rtype:

dict

returns:

Response Syntax

{}

Response Structure

  • (dict) --

ListPromptRouters (updated) Link ¶
Changes (request)
{'type': 'custom | default'}

Retrieves a list of prompt routers.

See also: AWS API Documentation

Request Syntax

client.list_prompt_routers(
    maxResults=123,
    nextToken='string',
    type='custom'|'default'
)
type maxResults:

integer

param maxResults:

The maximum number of prompt routers to return in one page of results.

type nextToken:

string

param nextToken:

Specify the pagination token from a previous request to retrieve the next page of results.

type type:

string

param type:

The type of the prompt routers, such as whether it's default or custom.

rtype:

dict

returns:

Response Syntax

{
    'promptRouterSummaries': [
        {
            'promptRouterName': 'string',
            'routingCriteria': {
                'responseQualityDifference': 123.0
            },
            'description': 'string',
            'createdAt': datetime(2015, 1, 1),
            'updatedAt': datetime(2015, 1, 1),
            'promptRouterArn': 'string',
            'models': [
                {
                    'modelArn': 'string'
                },
            ],
            'fallbackModel': {
                'modelArn': 'string'
            },
            'status': 'AVAILABLE',
            'type': 'custom'|'default'
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • promptRouterSummaries (list) --

      A list of prompt router summaries.

      • (dict) --

        Details about a prompt router.

        • promptRouterName (string) --

          The router's name.

        • routingCriteria (dict) --

          The router's routing criteria.

          • responseQualityDifference (float) --

            The criteria's response quality difference.

        • description (string) --

          The router's description.

        • createdAt (datetime) --

          When the router was created.

        • updatedAt (datetime) --

          When the router was updated.

        • promptRouterArn (string) --

          The router's ARN.

        • models (list) --

          The router's models.

          • (dict) --

            The target model for a prompt router.

            • modelArn (string) --

              The target model's ARN.

        • fallbackModel (dict) --

          The router's fallback model.

          • modelArn (string) --

            The target model's ARN.

        • status (string) --

          The router's status.

        • type (string) --

          The summary's type.

    • nextToken (string) --

      Specify the pagination token from a previous request to retrieve the next page of results.