Skip to content

Commit

Permalink
feat(client-bedrock): API and Documentation for Bedrock Model Copy fe…
Browse files Browse the repository at this point in the history
…ature. This feature lets you share and copy a custom model from one region to another or one account to another.
  • Loading branch information
awstools committed Aug 1, 2024
1 parent b43bb89 commit b85315c
Show file tree
Hide file tree
Showing 30 changed files with 1,559 additions and 70 deletions.
24 changes: 24 additions & 0 deletions clients/client-bedrock/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,14 @@ CreateGuardrailVersion

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock/command/CreateGuardrailVersionCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock/Interface/CreateGuardrailVersionCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock/Interface/CreateGuardrailVersionCommandOutput/)

</details>
<details>
<summary>
CreateModelCopyJob
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock/command/CreateModelCopyJobCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock/Interface/CreateModelCopyJobCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock/Interface/CreateModelCopyJobCommandOutput/)

</details>
<details>
<summary>
Expand Down Expand Up @@ -306,6 +314,14 @@ GetGuardrail

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock/command/GetGuardrailCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock/Interface/GetGuardrailCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock/Interface/GetGuardrailCommandOutput/)

</details>
<details>
<summary>
GetModelCopyJob
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock/command/GetModelCopyJobCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock/Interface/GetModelCopyJobCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock/Interface/GetModelCopyJobCommandOutput/)

</details>
<details>
<summary>
Expand Down Expand Up @@ -362,6 +378,14 @@ ListGuardrails

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock/command/ListGuardrailsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock/Interface/ListGuardrailsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock/Interface/ListGuardrailsCommandOutput/)

</details>
<details>
<summary>
ListModelCopyJobs
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock/command/ListModelCopyJobsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock/Interface/ListModelCopyJobsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock/Interface/ListModelCopyJobsCommandOutput/)

</details>
<details>
<summary>
Expand Down
67 changes: 67 additions & 0 deletions clients/client-bedrock/src/Bedrock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ import {
CreateGuardrailVersionCommandInput,
CreateGuardrailVersionCommandOutput,
} from "./commands/CreateGuardrailVersionCommand";
import {
CreateModelCopyJobCommand,
CreateModelCopyJobCommandInput,
CreateModelCopyJobCommandOutput,
} from "./commands/CreateModelCopyJobCommand";
import {
CreateModelCustomizationJobCommand,
CreateModelCustomizationJobCommandInput,
Expand Down Expand Up @@ -68,6 +73,11 @@ import {
GetGuardrailCommandInput,
GetGuardrailCommandOutput,
} from "./commands/GetGuardrailCommand";
import {
GetModelCopyJobCommand,
GetModelCopyJobCommandInput,
GetModelCopyJobCommandOutput,
} from "./commands/GetModelCopyJobCommand";
import {
GetModelCustomizationJobCommand,
GetModelCustomizationJobCommandInput,
Expand Down Expand Up @@ -103,6 +113,11 @@ import {
ListGuardrailsCommandInput,
ListGuardrailsCommandOutput,
} from "./commands/ListGuardrailsCommand";
import {
ListModelCopyJobsCommand,
ListModelCopyJobsCommandInput,
ListModelCopyJobsCommandOutput,
} from "./commands/ListModelCopyJobsCommand";
import {
ListModelCustomizationJobsCommand,
ListModelCustomizationJobsCommandInput,
Expand Down Expand Up @@ -154,6 +169,7 @@ const commands = {
CreateEvaluationJobCommand,
CreateGuardrailCommand,
CreateGuardrailVersionCommand,
CreateModelCopyJobCommand,
CreateModelCustomizationJobCommand,
CreateProvisionedModelThroughputCommand,
DeleteCustomModelCommand,
Expand All @@ -164,13 +180,15 @@ const commands = {
GetEvaluationJobCommand,
GetFoundationModelCommand,
GetGuardrailCommand,
GetModelCopyJobCommand,
GetModelCustomizationJobCommand,
GetModelInvocationLoggingConfigurationCommand,
GetProvisionedModelThroughputCommand,
ListCustomModelsCommand,
ListEvaluationJobsCommand,
ListFoundationModelsCommand,
ListGuardrailsCommand,
ListModelCopyJobsCommand,
ListModelCustomizationJobsCommand,
ListProvisionedModelThroughputsCommand,
ListTagsForResourceCommand,
Expand Down Expand Up @@ -232,6 +250,23 @@ export interface Bedrock {
cb: (err: any, data?: CreateGuardrailVersionCommandOutput) => void
): void;

/**
* @see {@link CreateModelCopyJobCommand}
*/
createModelCopyJob(
args: CreateModelCopyJobCommandInput,
options?: __HttpHandlerOptions
): Promise<CreateModelCopyJobCommandOutput>;
createModelCopyJob(
args: CreateModelCopyJobCommandInput,
cb: (err: any, data?: CreateModelCopyJobCommandOutput) => void
): void;
createModelCopyJob(
args: CreateModelCopyJobCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: CreateModelCopyJobCommandOutput) => void
): void;

/**
* @see {@link CreateModelCustomizationJobCommand}
*/
Expand Down Expand Up @@ -391,6 +426,20 @@ export interface Bedrock {
cb: (err: any, data?: GetGuardrailCommandOutput) => void
): void;

/**
* @see {@link GetModelCopyJobCommand}
*/
getModelCopyJob(
args: GetModelCopyJobCommandInput,
options?: __HttpHandlerOptions
): Promise<GetModelCopyJobCommandOutput>;
getModelCopyJob(args: GetModelCopyJobCommandInput, cb: (err: any, data?: GetModelCopyJobCommandOutput) => void): void;
getModelCopyJob(
args: GetModelCopyJobCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: GetModelCopyJobCommandOutput) => void
): void;

/**
* @see {@link GetModelCustomizationJobCommand}
*/
Expand Down Expand Up @@ -512,6 +561,24 @@ export interface Bedrock {
cb: (err: any, data?: ListGuardrailsCommandOutput) => void
): void;

/**
* @see {@link ListModelCopyJobsCommand}
*/
listModelCopyJobs(): Promise<ListModelCopyJobsCommandOutput>;
listModelCopyJobs(
args: ListModelCopyJobsCommandInput,
options?: __HttpHandlerOptions
): Promise<ListModelCopyJobsCommandOutput>;
listModelCopyJobs(
args: ListModelCopyJobsCommandInput,
cb: (err: any, data?: ListModelCopyJobsCommandOutput) => void
): void;
listModelCopyJobs(
args: ListModelCopyJobsCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: ListModelCopyJobsCommandOutput) => void
): void;

/**
* @see {@link ListModelCustomizationJobsCommand}
*/
Expand Down
9 changes: 9 additions & 0 deletions clients/client-bedrock/src/BedrockClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import {
CreateGuardrailVersionCommandInput,
CreateGuardrailVersionCommandOutput,
} from "./commands/CreateGuardrailVersionCommand";
import { CreateModelCopyJobCommandInput, CreateModelCopyJobCommandOutput } from "./commands/CreateModelCopyJobCommand";
import {
CreateModelCustomizationJobCommandInput,
CreateModelCustomizationJobCommandOutput,
Expand All @@ -84,6 +85,7 @@ import { GetCustomModelCommandInput, GetCustomModelCommandOutput } from "./comma
import { GetEvaluationJobCommandInput, GetEvaluationJobCommandOutput } from "./commands/GetEvaluationJobCommand";
import { GetFoundationModelCommandInput, GetFoundationModelCommandOutput } from "./commands/GetFoundationModelCommand";
import { GetGuardrailCommandInput, GetGuardrailCommandOutput } from "./commands/GetGuardrailCommand";
import { GetModelCopyJobCommandInput, GetModelCopyJobCommandOutput } from "./commands/GetModelCopyJobCommand";
import {
GetModelCustomizationJobCommandInput,
GetModelCustomizationJobCommandOutput,
Expand All @@ -103,6 +105,7 @@ import {
ListFoundationModelsCommandOutput,
} from "./commands/ListFoundationModelsCommand";
import { ListGuardrailsCommandInput, ListGuardrailsCommandOutput } from "./commands/ListGuardrailsCommand";
import { ListModelCopyJobsCommandInput, ListModelCopyJobsCommandOutput } from "./commands/ListModelCopyJobsCommand";
import {
ListModelCustomizationJobsCommandInput,
ListModelCustomizationJobsCommandOutput,
Expand Down Expand Up @@ -149,6 +152,7 @@ export type ServiceInputTypes =
| CreateEvaluationJobCommandInput
| CreateGuardrailCommandInput
| CreateGuardrailVersionCommandInput
| CreateModelCopyJobCommandInput
| CreateModelCustomizationJobCommandInput
| CreateProvisionedModelThroughputCommandInput
| DeleteCustomModelCommandInput
Expand All @@ -159,13 +163,15 @@ export type ServiceInputTypes =
| GetEvaluationJobCommandInput
| GetFoundationModelCommandInput
| GetGuardrailCommandInput
| GetModelCopyJobCommandInput
| GetModelCustomizationJobCommandInput
| GetModelInvocationLoggingConfigurationCommandInput
| GetProvisionedModelThroughputCommandInput
| ListCustomModelsCommandInput
| ListEvaluationJobsCommandInput
| ListFoundationModelsCommandInput
| ListGuardrailsCommandInput
| ListModelCopyJobsCommandInput
| ListModelCustomizationJobsCommandInput
| ListProvisionedModelThroughputsCommandInput
| ListTagsForResourceCommandInput
Expand All @@ -184,6 +190,7 @@ export type ServiceOutputTypes =
| CreateEvaluationJobCommandOutput
| CreateGuardrailCommandOutput
| CreateGuardrailVersionCommandOutput
| CreateModelCopyJobCommandOutput
| CreateModelCustomizationJobCommandOutput
| CreateProvisionedModelThroughputCommandOutput
| DeleteCustomModelCommandOutput
Expand All @@ -194,13 +201,15 @@ export type ServiceOutputTypes =
| GetEvaluationJobCommandOutput
| GetFoundationModelCommandOutput
| GetGuardrailCommandOutput
| GetModelCopyJobCommandOutput
| GetModelCustomizationJobCommandOutput
| GetModelInvocationLoggingConfigurationCommandOutput
| GetProvisionedModelThroughputCommandOutput
| ListCustomModelsCommandOutput
| ListEvaluationJobsCommandOutput
| ListFoundationModelsCommandOutput
| ListGuardrailsCommandOutput
| ListModelCopyJobsCommandOutput
| ListModelCustomizationJobsCommandOutput
| ListProvisionedModelThroughputsCommandOutput
| ListTagsForResourceCommandOutput
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export interface CreateEvaluationJobCommandInput extends CreateEvaluationJobRequ
export interface CreateEvaluationJobCommandOutput extends CreateEvaluationJobResponse, __MetadataBearer {}

/**
* <p>API operation for creating and managing Amazon Bedrock automatic model evaluation jobs and model evaluation jobs that use human workers. To learn more about the requirements for creating a model evaluation job see, <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-evaluation.html">Model evaluations</a>.</p>
* <p>API operation for creating and managing Amazon Bedrock automatic model evaluation jobs and model evaluation jobs that use human workers. To learn more about the requirements for creating a model evaluation job see, <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-evaluation.html">Model evaluation</a>.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
Expand Down
104 changes: 104 additions & 0 deletions clients/client-bedrock/src/commands/CreateModelCopyJobCommand.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
// smithy-typescript generated code
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
import { getSerdePlugin } from "@smithy/middleware-serde";
import { Command as $Command } from "@smithy/smithy-client";
import { MetadataBearer as __MetadataBearer } from "@smithy/types";

import { BedrockClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../BedrockClient";
import { commonParams } from "../endpoint/EndpointParameters";
import { CreateModelCopyJobRequest, CreateModelCopyJobResponse } from "../models/models_0";
import { de_CreateModelCopyJobCommand, se_CreateModelCopyJobCommand } from "../protocols/Aws_restJson1";

/**
* @public
*/
export type { __MetadataBearer };
export { $Command };
/**
* @public
*
* The input for {@link CreateModelCopyJobCommand}.
*/
export interface CreateModelCopyJobCommandInput extends CreateModelCopyJobRequest {}
/**
* @public
*
* The output of {@link CreateModelCopyJobCommand}.
*/
export interface CreateModelCopyJobCommandOutput extends CreateModelCopyJobResponse, __MetadataBearer {}

/**
* <p>Copies a model to another region so that it can be used there. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/copy-model.html">Copy models to be used in other regions</a> in the <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-service.html">Amazon Bedrock User Guide</a>.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { BedrockClient, CreateModelCopyJobCommand } from "@aws-sdk/client-bedrock"; // ES Modules import
* // const { BedrockClient, CreateModelCopyJobCommand } = require("@aws-sdk/client-bedrock"); // CommonJS import
* const client = new BedrockClient(config);
* const input = { // CreateModelCopyJobRequest
* sourceModelArn: "STRING_VALUE", // required
* targetModelName: "STRING_VALUE", // required
* modelKmsKeyId: "STRING_VALUE",
* targetModelTags: [ // TagList
* { // Tag
* key: "STRING_VALUE", // required
* value: "STRING_VALUE", // required
* },
* ],
* clientRequestToken: "STRING_VALUE",
* };
* const command = new CreateModelCopyJobCommand(input);
* const response = await client.send(command);
* // { // CreateModelCopyJobResponse
* // jobArn: "STRING_VALUE", // required
* // };
*
* ```
*
* @param CreateModelCopyJobCommandInput - {@link CreateModelCopyJobCommandInput}
* @returns {@link CreateModelCopyJobCommandOutput}
* @see {@link CreateModelCopyJobCommandInput} for command's `input` shape.
* @see {@link CreateModelCopyJobCommandOutput} for command's `response` shape.
* @see {@link BedrockClientResolvedConfig | config} for BedrockClient's `config` shape.
*
* @throws {@link AccessDeniedException} (client fault)
* <p>The request is denied because of missing access permissions.</p>
*
* @throws {@link InternalServerException} (server fault)
* <p>An internal server error occurred. Retry your request.</p>
*
* @throws {@link ResourceNotFoundException} (client fault)
* <p>The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.</p>
*
* @throws {@link TooManyTagsException} (client fault)
* <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>
*
* @throws {@link BedrockServiceException}
* <p>Base exception class for all service exceptions from Bedrock service.</p>
*
* @public
*/
export class CreateModelCopyJobCommand extends $Command
.classBuilder<
CreateModelCopyJobCommandInput,
CreateModelCopyJobCommandOutput,
BedrockClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes
>()
.ep({
...commonParams,
})
.m(function (this: any, Command: any, cs: any, config: BedrockClientResolvedConfig, o: any) {
return [
getSerdePlugin(config, this.serialize, this.deserialize),
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
];
})
.s("AmazonBedrockControlPlaneService", "CreateModelCopyJob", {})
.n("BedrockClient", "CreateModelCopyJobCommand")
.f(void 0, void 0)
.ser(se_CreateModelCopyJobCommand)
.de(de_CreateModelCopyJobCommand)
.build() {}
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ export interface CreateModelCustomizationJobCommandOutput
* </p>
* <p>For information on the format of training and validation data, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-customization-prepare.html">Prepare the datasets</a>.</p>
* <p>
* Model-customization jobs are asynchronous and the completion time depends on the base model and the training/validation data size.
* To monitor a job, use the <code>GetModelCustomizationJob</code> operation to retrieve the job status.</p>
* <p>For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/custom-models.html">Custom models</a> in the Amazon Bedrock User Guide.</p>
* Model-customization jobs are asynchronous and the completion time depends on the base model and the training/validation data size.
* To monitor a job, use the <code>GetModelCustomizationJob</code> operation to retrieve the job status.</p>
* <p>For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/custom-models.html">Custom models</a> in the <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-service.html">Amazon Bedrock User Guide</a>.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export interface CreateProvisionedModelThroughputCommandOutput
__MetadataBearer {}

/**
* <p>Creates dedicated throughput for a base or custom model with the model units and for the duration that you specify. For pricing details, see <a href="http://aws.amazon.com/bedrock/pricing/">Amazon Bedrock Pricing</a>. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/prov-throughput.html">Provisioned Throughput</a> in the Amazon Bedrock User Guide.</p>
* <p>Creates dedicated throughput for a base or custom model with the model units and for the duration that you specify. For pricing details, see <a href="http://aws.amazon.com/bedrock/pricing/">Amazon Bedrock Pricing</a>. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/prov-throughput.html">Provisioned Throughput</a> in the <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-service.html">Amazon Bedrock User Guide</a>.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface DeleteCustomModelCommandInput extends DeleteCustomModelRequest
export interface DeleteCustomModelCommandOutput extends DeleteCustomModelResponse, __MetadataBearer {}

/**
* <p>Deletes a custom model that you created earlier. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/custom-models.html">Custom models</a> in the Amazon Bedrock User Guide.</p>
* <p>Deletes a custom model that you created earlier. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/custom-models.html">Custom models</a> in the <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-service.html">Amazon Bedrock User Guide</a>.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
Expand Down
Loading

0 comments on commit b85315c

Please sign in to comment.