Skip to content

Commit c1459bc

Browse files
author
awstools
committed
feat(client-bedrock): This release of the SDK has the API and documentation for the createcustommodel API. This feature lets you copy a Amazon SageMaker trained Amazon Nova model into Amazon Bedrock for inference.
1 parent 797e80c commit c1459bc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+3654
-4432
lines changed

clients/client-bedrock/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,14 @@ BatchDeleteEvaluationJob
210210

211211
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock/command/BatchDeleteEvaluationJobCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock/Interface/BatchDeleteEvaluationJobCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock/Interface/BatchDeleteEvaluationJobCommandOutput/)
212212

213+
</details>
214+
<details>
215+
<summary>
216+
CreateCustomModel
217+
</summary>
218+
219+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock/command/CreateCustomModelCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock/Interface/CreateCustomModelCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock/Interface/CreateCustomModelCommandOutput/)
220+
213221
</details>
214222
<details>
215223
<summary>

clients/client-bedrock/src/Bedrock.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ import {
88
BatchDeleteEvaluationJobCommandInput,
99
BatchDeleteEvaluationJobCommandOutput,
1010
} from "./commands/BatchDeleteEvaluationJobCommand";
11+
import {
12+
CreateCustomModelCommand,
13+
CreateCustomModelCommandInput,
14+
CreateCustomModelCommandOutput,
15+
} from "./commands/CreateCustomModelCommand";
1116
import {
1217
CreateEvaluationJobCommand,
1318
CreateEvaluationJobCommandInput,
@@ -297,6 +302,7 @@ import {
297302

298303
const commands = {
299304
BatchDeleteEvaluationJobCommand,
305+
CreateCustomModelCommand,
300306
CreateEvaluationJobCommand,
301307
CreateGuardrailCommand,
302308
CreateGuardrailVersionCommand,
@@ -375,6 +381,23 @@ export interface Bedrock {
375381
cb: (err: any, data?: BatchDeleteEvaluationJobCommandOutput) => void
376382
): void;
377383

384+
/**
385+
* @see {@link CreateCustomModelCommand}
386+
*/
387+
createCustomModel(
388+
args: CreateCustomModelCommandInput,
389+
options?: __HttpHandlerOptions
390+
): Promise<CreateCustomModelCommandOutput>;
391+
createCustomModel(
392+
args: CreateCustomModelCommandInput,
393+
cb: (err: any, data?: CreateCustomModelCommandOutput) => void
394+
): void;
395+
createCustomModel(
396+
args: CreateCustomModelCommandInput,
397+
options: __HttpHandlerOptions,
398+
cb: (err: any, data?: CreateCustomModelCommandOutput) => void
399+
): void;
400+
378401
/**
379402
* @see {@link CreateEvaluationJobCommand}
380403
*/

clients/client-bedrock/src/BedrockClient.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ import {
5757
BatchDeleteEvaluationJobCommandInput,
5858
BatchDeleteEvaluationJobCommandOutput,
5959
} from "./commands/BatchDeleteEvaluationJobCommand";
60+
import { CreateCustomModelCommandInput, CreateCustomModelCommandOutput } from "./commands/CreateCustomModelCommand";
6061
import {
6162
CreateEvaluationJobCommandInput,
6263
CreateEvaluationJobCommandOutput,
@@ -233,6 +234,7 @@ export { __Client };
233234
*/
234235
export type ServiceInputTypes =
235236
| BatchDeleteEvaluationJobCommandInput
237+
| CreateCustomModelCommandInput
236238
| CreateEvaluationJobCommandInput
237239
| CreateGuardrailCommandInput
238240
| CreateGuardrailVersionCommandInput
@@ -297,6 +299,7 @@ export type ServiceInputTypes =
297299
*/
298300
export type ServiceOutputTypes =
299301
| BatchDeleteEvaluationJobCommandOutput
302+
| CreateCustomModelCommandOutput
300303
| CreateEvaluationJobCommandOutput
301304
| CreateGuardrailCommandOutput
302305
| CreateGuardrailVersionCommandOutput

clients/client-bedrock/src/commands/BatchDeleteEvaluationJobCommand.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ export interface BatchDeleteEvaluationJobCommandInput extends BatchDeleteEvaluat
3333
export interface BatchDeleteEvaluationJobCommandOutput extends BatchDeleteEvaluationJobResponse, __MetadataBearer {}
3434

3535
/**
36-
* <p>Deletes a batch of evaluation jobs. An evaluation job can only be deleted if it has
37-
* following status <code>FAILED</code>, <code>COMPLETED</code>, and <code>STOPPED</code>.
38-
* You can request up to 25 model evaluation jobs be deleted in a single request.</p>
36+
* <p>Deletes a batch of evaluation jobs. An evaluation job can only be deleted if it has following status <code>FAILED</code>, <code>COMPLETED</code>, and <code>STOPPED</code>. You can request up to 25 model evaluation jobs be deleted in a single request.</p>
3937
* @example
4038
* Use a bare-bones client and the command you need to make an API call.
4139
* ```javascript
Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
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 { CreateCustomModelRequest, CreateCustomModelResponse } from "../models/models_0";
10+
import { de_CreateCustomModelCommand, se_CreateCustomModelCommand } from "../protocols/Aws_restJson1";
11+
12+
/**
13+
* @public
14+
*/
15+
export type { __MetadataBearer };
16+
export { $Command };
17+
/**
18+
* @public
19+
*
20+
* The input for {@link CreateCustomModelCommand}.
21+
*/
22+
export interface CreateCustomModelCommandInput extends CreateCustomModelRequest {}
23+
/**
24+
* @public
25+
*
26+
* The output of {@link CreateCustomModelCommand}.
27+
*/
28+
export interface CreateCustomModelCommandOutput extends CreateCustomModelResponse, __MetadataBearer {}
29+
30+
/**
31+
* <p>Creates a new custom model in Amazon Bedrock from an existing SageMaker AI-trained Amazon Nova model stored in an Amazon-managed Amazon S3 bucket. After the model is active, you can use it for inference.</p> <p>To use the model for inference, you must purchase Provisioned Throughput for it. You can't use On-demand inference with these custom models. For more information about Provisioned Throughput, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/prov-throughput.html">Provisioned Throughput</a>.</p> <p>The model appears in <code>ListCustomModels</code> with a <code>customizationType</code> of <code>imported</code>. To track the status of the new model, you use the <code>GetCustomModel</code> API operation. The model can be in the following states:</p> <ul> <li> <p> <code>Creating</code> - Initial state during validation and registration</p> </li> <li> <p> <code>Active</code> - Model is ready for use in inference</p> </li> <li> <p> <code>Failed</code> - Creation process encountered an error</p> </li> </ul> <p>For more information about creating custom models, including specific model requirements, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/create-custom-model-from-existing.html">Import a SageMaker AI-trained Amazon Nova model</a> in the Amazon Bedrock User Guide. </p> <note> <p>You use the <code>CreateCustomModel</code> API to import only SageMaker AI-trained Amazon Nova models. To import open-source models, you use the <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_CreateModelImportJob.html">CreateModelImportJob</a>. </p> </note> <p> <b>Related APIs</b> </p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_GetCustomModel.html">GetCustomModel</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_ListCustomModels.html">ListCustomModels</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_DeleteCustomModel.html">DeleteCustomModel</a> </p> </li> </ul>
32+
* @example
33+
* Use a bare-bones client and the command you need to make an API call.
34+
* ```javascript
35+
* import { BedrockClient, CreateCustomModelCommand } from "@aws-sdk/client-bedrock"; // ES Modules import
36+
* // const { BedrockClient, CreateCustomModelCommand } = require("@aws-sdk/client-bedrock"); // CommonJS import
37+
* const client = new BedrockClient(config);
38+
* const input = { // CreateCustomModelRequest
39+
* modelName: "STRING_VALUE", // required
40+
* modelSourceConfig: { // ModelDataSource Union: only one key present
41+
* s3DataSource: { // S3DataSource
42+
* s3Uri: "STRING_VALUE", // required
43+
* },
44+
* },
45+
* modelKmsKeyArn: "STRING_VALUE",
46+
* roleArn: "STRING_VALUE",
47+
* modelTags: [ // TagList
48+
* { // Tag
49+
* key: "STRING_VALUE", // required
50+
* value: "STRING_VALUE", // required
51+
* },
52+
* ],
53+
* clientRequestToken: "STRING_VALUE",
54+
* };
55+
* const command = new CreateCustomModelCommand(input);
56+
* const response = await client.send(command);
57+
* // { // CreateCustomModelResponse
58+
* // modelArn: "STRING_VALUE", // required
59+
* // };
60+
*
61+
* ```
62+
*
63+
* @param CreateCustomModelCommandInput - {@link CreateCustomModelCommandInput}
64+
* @returns {@link CreateCustomModelCommandOutput}
65+
* @see {@link CreateCustomModelCommandInput} for command's `input` shape.
66+
* @see {@link CreateCustomModelCommandOutput} for command's `response` shape.
67+
* @see {@link BedrockClientResolvedConfig | config} for BedrockClient's `config` shape.
68+
*
69+
* @throws {@link AccessDeniedException} (client fault)
70+
* <p>The request is denied because of missing access permissions.</p>
71+
*
72+
* @throws {@link ConflictException} (client fault)
73+
* <p>Error occurred because of a conflict while performing an operation.</p>
74+
*
75+
* @throws {@link InternalServerException} (server fault)
76+
* <p>An internal server error occurred. Retry your request.</p>
77+
*
78+
* @throws {@link ResourceNotFoundException} (client fault)
79+
* <p>The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.</p>
80+
*
81+
* @throws {@link ServiceQuotaExceededException} (client fault)
82+
* <p>The number of requests exceeds the service quota. Resubmit your request later.</p>
83+
*
84+
* @throws {@link ThrottlingException} (client fault)
85+
* <p>The number of requests exceeds the limit. Resubmit your request later.</p>
86+
*
87+
* @throws {@link TooManyTagsException} (client fault)
88+
* <p>The request contains more tags than can be associated with a resource (50 tags per resource). The maximum number of tags includes both existing tags and those included in your current request. </p>
89+
*
90+
* @throws {@link ValidationException} (client fault)
91+
* <p>Input validation failed. Check your request parameters and retry the request.</p>
92+
*
93+
* @throws {@link BedrockServiceException}
94+
* <p>Base exception class for all service exceptions from Bedrock service.</p>
95+
*
96+
*
97+
* @example Successful CreateCustomModel API call
98+
* ```javascript
99+
* //
100+
* const input = {
101+
* clientRequestToken: "foo",
102+
* modelKmsKeyArn: "arn:aws:kms:us-east-1:123456789012:key/1234abcd-12ab-34cd-56ef-1234567890ab",
103+
* modelName: "SampleModel",
104+
* modelSourceConfig: {
105+
* s3DataSource: {
106+
* s3Uri: "s3://my-bucket/folder"
107+
* }
108+
* },
109+
* modelTags: [
110+
* {
111+
* key: "foo",
112+
* value: "foo"
113+
* },
114+
* {
115+
* key: "foo",
116+
* value: "foo"
117+
* }
118+
* ],
119+
* roleArn: "arn:aws:iam::123456789012:role/SampleRole"
120+
* };
121+
* const command = new CreateCustomModelCommand(input);
122+
* const response = await client.send(command);
123+
* /* response is
124+
* {
125+
* modelArn: "arn:aws:bedrock:us-east-1:123456789012:custom-model/imported/abcdef123456"
126+
* }
127+
* *\/
128+
* ```
129+
*
130+
* @public
131+
*/
132+
export class CreateCustomModelCommand extends $Command
133+
.classBuilder<
134+
CreateCustomModelCommandInput,
135+
CreateCustomModelCommandOutput,
136+
BedrockClientResolvedConfig,
137+
ServiceInputTypes,
138+
ServiceOutputTypes
139+
>()
140+
.ep(commonParams)
141+
.m(function (this: any, Command: any, cs: any, config: BedrockClientResolvedConfig, o: any) {
142+
return [
143+
getSerdePlugin(config, this.serialize, this.deserialize),
144+
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
145+
];
146+
})
147+
.s("AmazonBedrockControlPlaneService", "CreateCustomModel", {})
148+
.n("BedrockClient", "CreateCustomModelCommand")
149+
.f(void 0, void 0)
150+
.ser(se_CreateCustomModelCommand)
151+
.de(de_CreateCustomModelCommand)
152+
.build() {
153+
/** @internal type navigation helper, not in runtime. */
154+
protected declare static __types: {
155+
api: {
156+
input: CreateCustomModelRequest;
157+
output: CreateCustomModelResponse;
158+
};
159+
sdk: {
160+
input: CreateCustomModelCommandInput;
161+
output: CreateCustomModelCommandOutput;
162+
};
163+
};
164+
}

clients/client-bedrock/src/commands/CreateEvaluationJobCommand.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@ import { MetadataBearer as __MetadataBearer } from "@smithy/types";
66

77
import { BedrockClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../BedrockClient";
88
import { commonParams } from "../endpoint/EndpointParameters";
9-
import {
10-
CreateEvaluationJobRequest,
11-
CreateEvaluationJobRequestFilterSensitiveLog,
12-
CreateEvaluationJobResponse,
13-
} from "../models/models_0";
9+
import { CreateEvaluationJobResponse } from "../models/models_0";
10+
import { CreateEvaluationJobRequest, CreateEvaluationJobRequestFilterSensitiveLog } from "../models/models_1";
1411
import { de_CreateEvaluationJobCommand, se_CreateEvaluationJobCommand } from "../protocols/Aws_restJson1";
1512

1613
/**

clients/client-bedrock/src/commands/CreateGuardrailCommand.ts

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -32,38 +32,7 @@ export interface CreateGuardrailCommandInput extends CreateGuardrailRequest {}
3232
export interface CreateGuardrailCommandOutput extends CreateGuardrailResponse, __MetadataBearer {}
3333

3434
/**
35-
* <p>Creates a guardrail to block topics and to implement safeguards for your generative AI applications.</p>
36-
* <p>You can configure the following policies in a guardrail to avoid undesirable and harmful content, filter
37-
* out denied topics and words, and remove sensitive information for privacy protection.</p>
38-
* <ul>
39-
* <li>
40-
* <p>
41-
* <b>Content filters</b> - Adjust filter strengths
42-
* to block input prompts or model responses containing harmful content.</p>
43-
* </li>
44-
* <li>
45-
* <p>
46-
* <b>Denied topics</b> - Define a set of topics that
47-
* are undesirable in the context of your application. These topics will be blocked if
48-
* detected in user queries or model responses.</p>
49-
* </li>
50-
* <li>
51-
* <p>
52-
* <b>Word filters</b> - Configure filters to block
53-
* undesirable words, phrases, and profanity. Such words can include offensive terms,
54-
* competitor names etc.</p>
55-
* </li>
56-
* <li>
57-
* <p>
58-
* <b>Sensitive information filters</b> - Block or
59-
* mask sensitive information such as personally identifiable information (PII) or custom
60-
* regex in user inputs and model responses.</p>
61-
* </li>
62-
* </ul>
63-
* <p>In addition to the above policies, you can also configure the messages to be returned to
64-
* the user if a user input or model response is in violation of the policies defined in the guardrail.</p>
65-
* <p>For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails.html">Amazon Bedrock Guardrails</a> in
66-
* the <i>Amazon Bedrock User Guide</i>.</p>
35+
* <p>Creates a guardrail to block topics and to implement safeguards for your generative AI applications.</p> <p>You can configure the following policies in a guardrail to avoid undesirable and harmful content, filter out denied topics and words, and remove sensitive information for privacy protection.</p> <ul> <li> <p> <b>Content filters</b> - Adjust filter strengths to block input prompts or model responses containing harmful content.</p> </li> <li> <p> <b>Denied topics</b> - Define a set of topics that are undesirable in the context of your application. These topics will be blocked if detected in user queries or model responses.</p> </li> <li> <p> <b>Word filters</b> - Configure filters to block undesirable words, phrases, and profanity. Such words can include offensive terms, competitor names etc.</p> </li> <li> <p> <b>Sensitive information filters</b> - Block or mask sensitive information such as personally identifiable information (PII) or custom regex in user inputs and model responses.</p> </li> </ul> <p>In addition to the above policies, you can also configure the messages to be returned to the user if a user input or model response is in violation of the policies defined in the guardrail.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails.html">Amazon Bedrock Guardrails</a> in the <i>Amazon Bedrock User Guide</i>.</p>
6736
* @example
6837
* Use a bare-bones client and the command you need to make an API call.
6938
* ```javascript
@@ -212,8 +181,7 @@ export interface CreateGuardrailCommandOutput extends CreateGuardrailResponse, _
212181
* <p>The number of requests exceeds the limit. Resubmit your request later.</p>
213182
*
214183
* @throws {@link TooManyTagsException} (client fault)
215-
* <p>The request contains more tags than can be associated with a resource (50 tags per resource).
216-
* The maximum number of tags includes both existing tags and those included in your current request. </p>
184+
* <p>The request contains more tags than can be associated with a resource (50 tags per resource). The maximum number of tags includes both existing tags and those included in your current request. </p>
217185
*
218186
* @throws {@link ValidationException} (client fault)
219187
* <p>Input validation failed. Check your request parameters and retry the request.</p>

clients/client-bedrock/src/commands/CreateGuardrailVersionCommand.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ export interface CreateGuardrailVersionCommandInput extends CreateGuardrailVersi
3232
export interface CreateGuardrailVersionCommandOutput extends CreateGuardrailVersionResponse, __MetadataBearer {}
3333

3434
/**
35-
* <p>Creates a version of the guardrail. Use this API to create a snapshot of the
36-
* guardrail when you are satisfied with a configuration, or to compare the configuration with another version.</p>
35+
* <p>Creates a version of the guardrail. Use this API to create a snapshot of the guardrail when you are satisfied with a configuration, or to compare the configuration with another version.</p>
3736
* @example
3837
* Use a bare-bones client and the command you need to make an API call.
3938
* ```javascript

clients/client-bedrock/src/commands/CreateInferenceProfileCommand.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@ export interface CreateInferenceProfileCommandOutput extends CreateInferenceProf
8787
* <p>The number of requests exceeds the limit. Resubmit your request later.</p>
8888
*
8989
* @throws {@link TooManyTagsException} (client fault)
90-
* <p>The request contains more tags than can be associated with a resource (50 tags per resource).
91-
* The maximum number of tags includes both existing tags and those included in your current request. </p>
90+
* <p>The request contains more tags than can be associated with a resource (50 tags per resource). The maximum number of tags includes both existing tags and those included in your current request. </p>
9291
*
9392
* @throws {@link ValidationException} (client fault)
9493
* <p>Input validation failed. Check your request parameters and retry the request.</p>

clients/client-bedrock/src/commands/CreateMarketplaceModelEndpointCommand.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ export interface CreateMarketplaceModelEndpointCommandOutput
3333
__MetadataBearer {}
3434

3535
/**
36-
* <p>Creates an endpoint for a model from Amazon Bedrock Marketplace. The endpoint is hosted by
37-
* Amazon SageMaker.</p>
36+
* <p>Creates an endpoint for a model from Amazon Bedrock Marketplace. The endpoint is hosted by Amazon SageMaker.</p>
3837
* @example
3938
* Use a bare-bones client and the command you need to make an API call.
4039
* ```javascript

0 commit comments

Comments
 (0)