Bedrock / Client / create_prompt_router

create_prompt_router#

Bedrock.Client.create_prompt_router(**kwargs)#

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

response = 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'
        },
    ]
)
Parameters:
  • clientRequestToken (string) –

    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.

  • promptRouterName (string) –

    [REQUIRED]

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

  • models (list) –

    [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.

  • description (string) – An optional description of the prompt router to help identify its purpose.

  • routingCriteria (dict) –

    [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.

  • fallbackModel (dict) –

    [REQUIRED]

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

    • modelArn (string) – [REQUIRED]

      The target model’s ARN.

  • tags (list) –

    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.

Return type:

dict

Returns:

Response Syntax

{
    'promptRouterArn': 'string'
}

Response Structure

  • (dict) –

    • promptRouterArn (string) –

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

Exceptions

  • Bedrock.Client.exceptions.ResourceNotFoundException

  • Bedrock.Client.exceptions.AccessDeniedException

  • Bedrock.Client.exceptions.ValidationException

  • Bedrock.Client.exceptions.ConflictException

  • Bedrock.Client.exceptions.InternalServerException

  • Bedrock.Client.exceptions.TooManyTagsException

  • Bedrock.Client.exceptions.ServiceQuotaExceededException

  • Bedrock.Client.exceptions.ThrottlingException