Skip to content

Commit 4adb0c3

Browse files
author
awstools
committed
feat(client-bedrock): This releases adds support for Custom Prompt Router
1 parent 84a664c commit 4adb0c3

File tree

11 files changed

+710
-19
lines changed

11 files changed

+710
-19
lines changed

clients/client-bedrock/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,14 @@ CreateModelInvocationJob
282282

283283
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock/command/CreateModelInvocationJobCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock/Interface/CreateModelInvocationJobCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock/Interface/CreateModelInvocationJobCommandOutput/)
284284

285+
</details>
286+
<details>
287+
<summary>
288+
CreatePromptRouter
289+
</summary>
290+
291+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock/command/CreatePromptRouterCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock/Interface/CreatePromptRouterCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock/Interface/CreatePromptRouterCommandOutput/)
292+
285293
</details>
286294
<details>
287295
<summary>
@@ -338,6 +346,14 @@ DeleteModelInvocationLoggingConfiguration
338346

339347
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock/command/DeleteModelInvocationLoggingConfigurationCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock/Interface/DeleteModelInvocationLoggingConfigurationCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock/Interface/DeleteModelInvocationLoggingConfigurationCommandOutput/)
340348

349+
</details>
350+
<details>
351+
<summary>
352+
DeletePromptRouter
353+
</summary>
354+
355+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock/command/DeletePromptRouterCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock/Interface/DeletePromptRouterCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock/Interface/DeletePromptRouterCommandOutput/)
356+
341357
</details>
342358
<details>
343359
<summary>

clients/client-bedrock/src/Bedrock.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ import {
5353
CreateModelInvocationJobCommandInput,
5454
CreateModelInvocationJobCommandOutput,
5555
} from "./commands/CreateModelInvocationJobCommand";
56+
import {
57+
CreatePromptRouterCommand,
58+
CreatePromptRouterCommandInput,
59+
CreatePromptRouterCommandOutput,
60+
} from "./commands/CreatePromptRouterCommand";
5661
import {
5762
CreateProvisionedModelThroughputCommand,
5863
CreateProvisionedModelThroughputCommandInput,
@@ -88,6 +93,11 @@ import {
8893
DeleteModelInvocationLoggingConfigurationCommandInput,
8994
DeleteModelInvocationLoggingConfigurationCommandOutput,
9095
} from "./commands/DeleteModelInvocationLoggingConfigurationCommand";
96+
import {
97+
DeletePromptRouterCommand,
98+
DeletePromptRouterCommandInput,
99+
DeletePromptRouterCommandOutput,
100+
} from "./commands/DeletePromptRouterCommand";
91101
import {
92102
DeleteProvisionedModelThroughputCommand,
93103
DeleteProvisionedModelThroughputCommandInput,
@@ -296,13 +306,15 @@ const commands = {
296306
CreateModelCustomizationJobCommand,
297307
CreateModelImportJobCommand,
298308
CreateModelInvocationJobCommand,
309+
CreatePromptRouterCommand,
299310
CreateProvisionedModelThroughputCommand,
300311
DeleteCustomModelCommand,
301312
DeleteGuardrailCommand,
302313
DeleteImportedModelCommand,
303314
DeleteInferenceProfileCommand,
304315
DeleteMarketplaceModelEndpointCommand,
305316
DeleteModelInvocationLoggingConfigurationCommand,
317+
DeletePromptRouterCommand,
306318
DeleteProvisionedModelThroughputCommand,
307319
DeregisterMarketplaceModelEndpointCommand,
308320
GetCustomModelCommand,
@@ -513,6 +525,23 @@ export interface Bedrock {
513525
cb: (err: any, data?: CreateModelInvocationJobCommandOutput) => void
514526
): void;
515527

528+
/**
529+
* @see {@link CreatePromptRouterCommand}
530+
*/
531+
createPromptRouter(
532+
args: CreatePromptRouterCommandInput,
533+
options?: __HttpHandlerOptions
534+
): Promise<CreatePromptRouterCommandOutput>;
535+
createPromptRouter(
536+
args: CreatePromptRouterCommandInput,
537+
cb: (err: any, data?: CreatePromptRouterCommandOutput) => void
538+
): void;
539+
createPromptRouter(
540+
args: CreatePromptRouterCommandInput,
541+
options: __HttpHandlerOptions,
542+
cb: (err: any, data?: CreatePromptRouterCommandOutput) => void
543+
): void;
544+
516545
/**
517546
* @see {@link CreateProvisionedModelThroughputCommand}
518547
*/
@@ -630,6 +659,23 @@ export interface Bedrock {
630659
cb: (err: any, data?: DeleteModelInvocationLoggingConfigurationCommandOutput) => void
631660
): void;
632661

662+
/**
663+
* @see {@link DeletePromptRouterCommand}
664+
*/
665+
deletePromptRouter(
666+
args: DeletePromptRouterCommandInput,
667+
options?: __HttpHandlerOptions
668+
): Promise<DeletePromptRouterCommandOutput>;
669+
deletePromptRouter(
670+
args: DeletePromptRouterCommandInput,
671+
cb: (err: any, data?: DeletePromptRouterCommandOutput) => void
672+
): void;
673+
deletePromptRouter(
674+
args: DeletePromptRouterCommandInput,
675+
options: __HttpHandlerOptions,
676+
cb: (err: any, data?: DeletePromptRouterCommandOutput) => void
677+
): void;
678+
633679
/**
634680
* @see {@link DeleteProvisionedModelThroughputCommand}
635681
*/

clients/client-bedrock/src/BedrockClient.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ import {
8787
CreateModelInvocationJobCommandInput,
8888
CreateModelInvocationJobCommandOutput,
8989
} from "./commands/CreateModelInvocationJobCommand";
90+
import { CreatePromptRouterCommandInput, CreatePromptRouterCommandOutput } from "./commands/CreatePromptRouterCommand";
9091
import {
9192
CreateProvisionedModelThroughputCommandInput,
9293
CreateProvisionedModelThroughputCommandOutput,
@@ -109,6 +110,7 @@ import {
109110
DeleteModelInvocationLoggingConfigurationCommandInput,
110111
DeleteModelInvocationLoggingConfigurationCommandOutput,
111112
} from "./commands/DeleteModelInvocationLoggingConfigurationCommand";
113+
import { DeletePromptRouterCommandInput, DeletePromptRouterCommandOutput } from "./commands/DeletePromptRouterCommand";
112114
import {
113115
DeleteProvisionedModelThroughputCommandInput,
114116
DeleteProvisionedModelThroughputCommandOutput,
@@ -240,13 +242,15 @@ export type ServiceInputTypes =
240242
| CreateModelCustomizationJobCommandInput
241243
| CreateModelImportJobCommandInput
242244
| CreateModelInvocationJobCommandInput
245+
| CreatePromptRouterCommandInput
243246
| CreateProvisionedModelThroughputCommandInput
244247
| DeleteCustomModelCommandInput
245248
| DeleteGuardrailCommandInput
246249
| DeleteImportedModelCommandInput
247250
| DeleteInferenceProfileCommandInput
248251
| DeleteMarketplaceModelEndpointCommandInput
249252
| DeleteModelInvocationLoggingConfigurationCommandInput
253+
| DeletePromptRouterCommandInput
250254
| DeleteProvisionedModelThroughputCommandInput
251255
| DeregisterMarketplaceModelEndpointCommandInput
252256
| GetCustomModelCommandInput
@@ -302,13 +306,15 @@ export type ServiceOutputTypes =
302306
| CreateModelCustomizationJobCommandOutput
303307
| CreateModelImportJobCommandOutput
304308
| CreateModelInvocationJobCommandOutput
309+
| CreatePromptRouterCommandOutput
305310
| CreateProvisionedModelThroughputCommandOutput
306311
| DeleteCustomModelCommandOutput
307312
| DeleteGuardrailCommandOutput
308313
| DeleteImportedModelCommandOutput
309314
| DeleteInferenceProfileCommandOutput
310315
| DeleteMarketplaceModelEndpointCommandOutput
311316
| DeleteModelInvocationLoggingConfigurationCommandOutput
317+
| DeletePromptRouterCommandOutput
312318
| DeleteProvisionedModelThroughputCommandOutput
313319
| DeregisterMarketplaceModelEndpointCommandOutput
314320
| GetCustomModelCommandOutput
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
// smithy-typescript generated code
2+
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
3+
import { getSerdePlugin } from "@smithy/middleware-serde";
4+
import { Command as $Command } from "@smithy/smithy-client";
5+
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
6+
7+
import { BedrockClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../BedrockClient";
8+
import { commonParams } from "../endpoint/EndpointParameters";
9+
import {
10+
CreatePromptRouterRequest,
11+
CreatePromptRouterRequestFilterSensitiveLog,
12+
CreatePromptRouterResponse,
13+
} from "../models/models_0";
14+
import { de_CreatePromptRouterCommand, se_CreatePromptRouterCommand } from "../protocols/Aws_restJson1";
15+
16+
/**
17+
* @public
18+
*/
19+
export type { __MetadataBearer };
20+
export { $Command };
21+
/**
22+
* @public
23+
*
24+
* The input for {@link CreatePromptRouterCommand}.
25+
*/
26+
export interface CreatePromptRouterCommandInput extends CreatePromptRouterRequest {}
27+
/**
28+
* @public
29+
*
30+
* The output of {@link CreatePromptRouterCommand}.
31+
*/
32+
export interface CreatePromptRouterCommandOutput extends CreatePromptRouterResponse, __MetadataBearer {}
33+
34+
/**
35+
* <p>Creates a prompt router that manages the routing of requests between multiple foundation models based on the routing criteria.</p>
36+
* @example
37+
* Use a bare-bones client and the command you need to make an API call.
38+
* ```javascript
39+
* import { BedrockClient, CreatePromptRouterCommand } from "@aws-sdk/client-bedrock"; // ES Modules import
40+
* // const { BedrockClient, CreatePromptRouterCommand } = require("@aws-sdk/client-bedrock"); // CommonJS import
41+
* const client = new BedrockClient(config);
42+
* const input = { // CreatePromptRouterRequest
43+
* clientRequestToken: "STRING_VALUE",
44+
* promptRouterName: "STRING_VALUE", // required
45+
* models: [ // PromptRouterTargetModels // required
46+
* { // PromptRouterTargetModel
47+
* modelArn: "STRING_VALUE", // required
48+
* },
49+
* ],
50+
* description: "STRING_VALUE",
51+
* routingCriteria: { // RoutingCriteria
52+
* responseQualityDifference: Number("double"), // required
53+
* },
54+
* fallbackModel: {
55+
* modelArn: "STRING_VALUE", // required
56+
* },
57+
* tags: [ // TagList
58+
* { // Tag
59+
* key: "STRING_VALUE", // required
60+
* value: "STRING_VALUE", // required
61+
* },
62+
* ],
63+
* };
64+
* const command = new CreatePromptRouterCommand(input);
65+
* const response = await client.send(command);
66+
* // { // CreatePromptRouterResponse
67+
* // promptRouterArn: "STRING_VALUE",
68+
* // };
69+
*
70+
* ```
71+
*
72+
* @param CreatePromptRouterCommandInput - {@link CreatePromptRouterCommandInput}
73+
* @returns {@link CreatePromptRouterCommandOutput}
74+
* @see {@link CreatePromptRouterCommandInput} for command's `input` shape.
75+
* @see {@link CreatePromptRouterCommandOutput} for command's `response` shape.
76+
* @see {@link BedrockClientResolvedConfig | config} for BedrockClient's `config` shape.
77+
*
78+
* @throws {@link AccessDeniedException} (client fault)
79+
* <p>The request is denied because of missing access permissions.</p>
80+
*
81+
* @throws {@link ConflictException} (client fault)
82+
* <p>Error occurred because of a conflict while performing an operation.</p>
83+
*
84+
* @throws {@link InternalServerException} (server fault)
85+
* <p>An internal server error occurred. Retry your request.</p>
86+
*
87+
* @throws {@link ResourceNotFoundException} (client fault)
88+
* <p>The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.</p>
89+
*
90+
* @throws {@link ServiceQuotaExceededException} (client fault)
91+
* <p>The number of requests exceeds the service quota. Resubmit your request later.</p>
92+
*
93+
* @throws {@link ThrottlingException} (client fault)
94+
* <p>The number of requests exceeds the limit. Resubmit your request later.</p>
95+
*
96+
* @throws {@link TooManyTagsException} (client fault)
97+
* <p>The request contains more tags than can be associated with a resource (50 tags per resource).
98+
* The maximum number of tags includes both existing tags and those included in your current request. </p>
99+
*
100+
* @throws {@link ValidationException} (client fault)
101+
* <p>Input validation failed. Check your request parameters and retry the request.</p>
102+
*
103+
* @throws {@link BedrockServiceException}
104+
* <p>Base exception class for all service exceptions from Bedrock service.</p>
105+
*
106+
* @public
107+
*/
108+
export class CreatePromptRouterCommand extends $Command
109+
.classBuilder<
110+
CreatePromptRouterCommandInput,
111+
CreatePromptRouterCommandOutput,
112+
BedrockClientResolvedConfig,
113+
ServiceInputTypes,
114+
ServiceOutputTypes
115+
>()
116+
.ep(commonParams)
117+
.m(function (this: any, Command: any, cs: any, config: BedrockClientResolvedConfig, o: any) {
118+
return [
119+
getSerdePlugin(config, this.serialize, this.deserialize),
120+
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
121+
];
122+
})
123+
.s("AmazonBedrockControlPlaneService", "CreatePromptRouter", {})
124+
.n("BedrockClient", "CreatePromptRouterCommand")
125+
.f(CreatePromptRouterRequestFilterSensitiveLog, void 0)
126+
.ser(se_CreatePromptRouterCommand)
127+
.de(de_CreatePromptRouterCommand)
128+
.build() {
129+
/** @internal type navigation helper, not in runtime. */
130+
protected declare static __types: {
131+
api: {
132+
input: CreatePromptRouterRequest;
133+
output: CreatePromptRouterResponse;
134+
};
135+
sdk: {
136+
input: CreatePromptRouterCommandInput;
137+
output: CreatePromptRouterCommandOutput;
138+
};
139+
};
140+
}

0 commit comments

Comments
 (0)