From 54243d570a7f34853f3555be3920409b2af7183d Mon Sep 17 00:00:00 2001 From: awstools Date: Thu, 29 Aug 2024 19:20:06 +0000 Subject: [PATCH] feat(client-bedrock-runtime): Add support for imported-model in invokeModel and InvokeModelWithResponseStream. --- .../src/commands/ConverseCommand.ts | 5 +++- .../src/commands/ConverseStreamCommand.ts | 5 +++- .../src/commands/InvokeModelCommand.ts | 5 +++- .../InvokeModelWithResponseStreamCommand.ts | 5 +++- .../src/models/models_0.ts | 24 ++++++++++++++++--- .../aws-models/bedrock-runtime.json | 15 ++++++------ 6 files changed, 45 insertions(+), 14 deletions(-) diff --git a/clients/client-bedrock-runtime/src/commands/ConverseCommand.ts b/clients/client-bedrock-runtime/src/commands/ConverseCommand.ts index baf9e1bf2c42..1885ae7448e8 100644 --- a/clients/client-bedrock-runtime/src/commands/ConverseCommand.ts +++ b/clients/client-bedrock-runtime/src/commands/ConverseCommand.ts @@ -388,7 +388,10 @@ export interface ConverseCommandOutput extends ConverseResponse, __MetadataBeare *

The request failed due to an error while processing the model.

* * @throws {@link ModelNotReadyException} (client fault) - *

The model specified in the request is not ready to serve inference requests.

+ *

The model specified in the request is not ready to serve inference requests. The AWS SDK + * will automatically retry the operation up to 5 times. For information about configuring + * automatic retries, see Retry behavior in the AWS SDKs and Tools + * reference guide.

* * @throws {@link ModelTimeoutException} (client fault) *

The request took too long to process. Processing time exceeded the model timeout length.

diff --git a/clients/client-bedrock-runtime/src/commands/ConverseStreamCommand.ts b/clients/client-bedrock-runtime/src/commands/ConverseStreamCommand.ts index 22270ba18d61..43c3ebfdc017 100644 --- a/clients/client-bedrock-runtime/src/commands/ConverseStreamCommand.ts +++ b/clients/client-bedrock-runtime/src/commands/ConverseStreamCommand.ts @@ -387,7 +387,10 @@ export interface ConverseStreamCommandOutput extends ConverseStreamResponse, __M *

The request failed due to an error while processing the model.

* * @throws {@link ModelNotReadyException} (client fault) - *

The model specified in the request is not ready to serve inference requests.

+ *

The model specified in the request is not ready to serve inference requests. The AWS SDK + * will automatically retry the operation up to 5 times. For information about configuring + * automatic retries, see Retry behavior in the AWS SDKs and Tools + * reference guide.

* * @throws {@link ModelTimeoutException} (client fault) *

The request took too long to process. Processing time exceeded the model timeout length.

diff --git a/clients/client-bedrock-runtime/src/commands/InvokeModelCommand.ts b/clients/client-bedrock-runtime/src/commands/InvokeModelCommand.ts index ab2a99ac829c..2609e9a38c86 100644 --- a/clients/client-bedrock-runtime/src/commands/InvokeModelCommand.ts +++ b/clients/client-bedrock-runtime/src/commands/InvokeModelCommand.ts @@ -93,7 +93,10 @@ export interface InvokeModelCommandOutput extends InvokeModelCommandOutputType, *

The request failed due to an error while processing the model.

* * @throws {@link ModelNotReadyException} (client fault) - *

The model specified in the request is not ready to serve inference requests.

+ *

The model specified in the request is not ready to serve inference requests. The AWS SDK + * will automatically retry the operation up to 5 times. For information about configuring + * automatic retries, see Retry behavior in the AWS SDKs and Tools + * reference guide.

* * @throws {@link ModelTimeoutException} (client fault) *

The request took too long to process. Processing time exceeded the model timeout length.

diff --git a/clients/client-bedrock-runtime/src/commands/InvokeModelWithResponseStreamCommand.ts b/clients/client-bedrock-runtime/src/commands/InvokeModelWithResponseStreamCommand.ts index f4a82ca6e17f..fdbad94e73c4 100644 --- a/clients/client-bedrock-runtime/src/commands/InvokeModelWithResponseStreamCommand.ts +++ b/clients/client-bedrock-runtime/src/commands/InvokeModelWithResponseStreamCommand.ts @@ -119,7 +119,10 @@ export interface InvokeModelWithResponseStreamCommandOutput *

The request failed due to an error while processing the model.

* * @throws {@link ModelNotReadyException} (client fault) - *

The model specified in the request is not ready to serve inference requests.

+ *

The model specified in the request is not ready to serve inference requests. The AWS SDK + * will automatically retry the operation up to 5 times. For information about configuring + * automatic retries, see Retry behavior in the AWS SDKs and Tools + * reference guide.

* * @throws {@link ModelStreamErrorException} (client fault) *

An error occurred while streaming the response. Retry your request.

diff --git a/clients/client-bedrock-runtime/src/models/models_0.ts b/clients/client-bedrock-runtime/src/models/models_0.ts index 1929dc53f1bb..ac67882953b2 100644 --- a/clients/client-bedrock-runtime/src/models/models_0.ts +++ b/clients/client-bedrock-runtime/src/models/models_0.ts @@ -1780,18 +1780,22 @@ export interface ToolConfiguration { export interface ConverseRequest { /** *

The identifier for the model that you want to call.

- *

The modelId to provide depends on the type of model that you use:

+ *

The modelId to provide depends on the type of model or throughput that you use:

* + *

The Converse API doesn't support imported models.

* @public */ modelId: string | undefined; @@ -2065,12 +2069,16 @@ export class ModelErrorException extends __BaseException { } /** - *

The model specified in the request is not ready to serve inference requests.

+ *

The model specified in the request is not ready to serve inference requests. The AWS SDK + * will automatically retry the operation up to 5 times. For information about configuring + * automatic retries, see Retry behavior in the AWS SDKs and Tools + * reference guide.

* @public */ export class ModelNotReadyException extends __BaseException { readonly name: "ModelNotReadyException" = "ModelNotReadyException"; readonly $fault: "client" = "client"; + $retryable = {}; /** * @internal */ @@ -2178,18 +2186,22 @@ export interface GuardrailStreamConfiguration { export interface ConverseStreamRequest { /** *

The ID for the model.

- *

The modelId to provide depends on the type of model that you use:

+ *

The modelId to provide depends on the type of model or throughput that you use:

* + *

The Converse API doesn't support imported models.

* @public */ modelId: string | undefined; @@ -2884,6 +2896,9 @@ export interface InvokeModelRequest { *
  • *

    If you use a custom model, first purchase Provisioned Throughput for it. Then specify the ARN of the resulting provisioned model. For more information, see Use a custom model in Amazon Bedrock in the Amazon Bedrock User Guide.

    *
  • + *
  • + *

    If you use an imported model, specify the ARN of the imported model. You can get the model ARN from a successful call to CreateModelImportJob or from the Imported models page in the Amazon Bedrock console.

    + *
  • * * @public */ @@ -2975,6 +2990,9 @@ export interface InvokeModelWithResponseStreamRequest { *
  • *

    If you use a custom model, first purchase Provisioned Throughput for it. Then specify the ARN of the resulting provisioned model. For more information, see Use a custom model in Amazon Bedrock in the Amazon Bedrock User Guide.

    *
  • + *
  • + *

    If you use an imported model, specify the ARN of the imported model. You can get the model ARN from a successful call to CreateModelImportJob or from the Imported models page in the Amazon Bedrock console.

    + *
  • * * @public */ diff --git a/codegen/sdk-codegen/aws-models/bedrock-runtime.json b/codegen/sdk-codegen/aws-models/bedrock-runtime.json index 158351a8baaf..acbeddb68d83 100644 --- a/codegen/sdk-codegen/aws-models/bedrock-runtime.json +++ b/codegen/sdk-codegen/aws-models/bedrock-runtime.json @@ -1105,7 +1105,7 @@ "modelId": { "target": "com.amazonaws.bedrockruntime#ConversationalModelId", "traits": { - "smithy.api#documentation": "

    The identifier for the model that you want to call.

    \n

    The modelId to provide depends on the type of model that you use:

    \n ", + "smithy.api#documentation": "

    The identifier for the model that you want to call.

    \n

    The modelId to provide depends on the type of model or throughput that you use:

    \n \n

    The Converse API doesn't support imported models.

    ", "smithy.api#httpLabel": {}, "smithy.api#required": {} } @@ -1379,7 +1379,7 @@ "modelId": { "target": "com.amazonaws.bedrockruntime#ConversationalModelId", "traits": { - "smithy.api#documentation": "

    The ID for the model.

    \n

    The modelId to provide depends on the type of model that you use:

    \n ", + "smithy.api#documentation": "

    The ID for the model.

    \n

    The modelId to provide depends on the type of model or throughput that you use:

    \n \n

    The Converse API doesn't support imported models.

    ", "smithy.api#httpLabel": {}, "smithy.api#required": {} } @@ -2968,7 +2968,7 @@ "min": 1, "max": 2048 }, - "smithy.api#pattern": "^(arn:aws(-[^:]+)?:bedrock:[a-z0-9-]{1,20}:(([0-9]{12}:custom-model/[a-z0-9-]{1,63}[.]{1}[a-z0-9-]{1,63}/[a-z0-9]{12})|(:foundation-model/[a-z0-9-]{1,63}[.]{1}[a-z0-9-]{1,63}([.:]?[a-z0-9-]{1,63}))|([0-9]{12}:provisioned-model/[a-z0-9]{12})|([0-9]{12}:inference-profile/[a-zA-Z0-9-:.]+)))|([a-z0-9-]{1,63}[.]{1}[a-z0-9-]{1,63}([.:]?[a-z0-9-]{1,63}))|(([0-9a-zA-Z][_-]?)+)|([a-zA-Z0-9-:.]+)$" + "smithy.api#pattern": "^(arn:aws(-[^:]+)?:bedrock:[a-z0-9-]{1,20}:(([0-9]{12}:custom-model/[a-z0-9-]{1,63}[.]{1}[a-z0-9-]{1,63}/[a-z0-9]{12})|(:foundation-model/[a-z0-9-]{1,63}[.]{1}[a-z0-9-]{1,63}([.:]?[a-z0-9-]{1,63}))|([0-9]{12}:imported-model/[a-z0-9]{12})|([0-9]{12}:provisioned-model/[a-z0-9]{12})|([0-9]{12}:inference-profile/[a-zA-Z0-9-:.]+)))|([a-z0-9-]{1,63}[.]{1}[a-z0-9-]{1,63}([.:]?[a-z0-9-]{1,63}))|(([0-9a-zA-Z][_-]?)+)|([a-zA-Z0-9-:.]+)$" } }, "com.amazonaws.bedrockruntime#InvokeModelRequest": { @@ -2999,7 +2999,7 @@ "modelId": { "target": "com.amazonaws.bedrockruntime#InvokeModelIdentifier", "traits": { - "smithy.api#documentation": "

    The unique identifier of the model to invoke to run inference.

    \n

    The modelId to provide depends on the type of model that you use:

    \n ", + "smithy.api#documentation": "

    The unique identifier of the model to invoke to run inference.

    \n

    The modelId to provide depends on the type of model that you use:

    \n ", "smithy.api#httpLabel": {}, "smithy.api#required": {} } @@ -3134,7 +3134,7 @@ "modelId": { "target": "com.amazonaws.bedrockruntime#InvokeModelIdentifier", "traits": { - "smithy.api#documentation": "

    The unique identifier of the model to invoke to run inference.

    \n

    The modelId to provide depends on the type of model that you use:

    \n ", + "smithy.api#documentation": "

    The unique identifier of the model to invoke to run inference.

    \n

    The modelId to provide depends on the type of model that you use:

    \n ", "smithy.api#httpLabel": {}, "smithy.api#required": {} } @@ -3289,9 +3289,10 @@ } }, "traits": { - "smithy.api#documentation": "

    The model specified in the request is not ready to serve inference requests.

    ", + "smithy.api#documentation": "

    The model specified in the request is not ready to serve inference requests. The AWS SDK\n will automatically retry the operation up to 5 times. For information about configuring\n automatic retries, see Retry behavior in the AWS SDKs and Tools\n reference guide.

    ", "smithy.api#error": "client", - "smithy.api#httpError": 429 + "smithy.api#httpError": 429, + "smithy.api#retryable": {} } }, "com.amazonaws.bedrockruntime#ModelOutputs": {