diff --git a/clients/client-bedrock-runtime/README.md b/clients/client-bedrock-runtime/README.md index bc1c1fa811a6..4a17c5c45156 100644 --- a/clients/client-bedrock-runtime/README.md +++ b/clients/client-bedrock-runtime/README.md @@ -23,16 +23,16 @@ using your favorite package manager: The AWS SDK is modulized by clients and commands. To send a request, you only need to import the `BedrockRuntimeClient` and -the commands you need, for example `ConverseCommand`: +the commands you need, for example `ListAsyncInvokesCommand`: ```js // ES5 example -const { BedrockRuntimeClient, ConverseCommand } = require("@aws-sdk/client-bedrock-runtime"); +const { BedrockRuntimeClient, ListAsyncInvokesCommand } = require("@aws-sdk/client-bedrock-runtime"); ``` ```ts // ES6+ example -import { BedrockRuntimeClient, ConverseCommand } from "@aws-sdk/client-bedrock-runtime"; +import { BedrockRuntimeClient, ListAsyncInvokesCommand } from "@aws-sdk/client-bedrock-runtime"; ``` ### Usage @@ -51,7 +51,7 @@ const client = new BedrockRuntimeClient({ region: "REGION" }); const params = { /** input parameters */ }; -const command = new ConverseCommand(params); +const command = new ListAsyncInvokesCommand(params); ``` #### Async/await @@ -130,7 +130,7 @@ const client = new AWS.BedrockRuntime({ region: "REGION" }); // async/await. try { - const data = await client.converse(params); + const data = await client.listAsyncInvokes(params); // process data. } catch (error) { // error handling. @@ -138,7 +138,7 @@ try { // Promises. client - .converse(params) + .listAsyncInvokes(params) .then((data) => { // process data. }) @@ -147,7 +147,7 @@ client }); // callbacks. -client.converse(params, (err, data) => { +client.listAsyncInvokes(params, (err, data) => { // process err and data. }); ``` @@ -226,6 +226,14 @@ ConverseStream [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock-runtime/command/ConverseStreamCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-runtime/Interface/ConverseStreamCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-runtime/Interface/ConverseStreamCommandOutput/) + +
+ +GetAsyncInvoke + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock-runtime/command/GetAsyncInvokeCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-runtime/Interface/GetAsyncInvokeCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-runtime/Interface/GetAsyncInvokeCommandOutput/) +
@@ -243,3 +251,19 @@ InvokeModelWithResponseStream [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock-runtime/command/InvokeModelWithResponseStreamCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-runtime/Interface/InvokeModelWithResponseStreamCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-runtime/Interface/InvokeModelWithResponseStreamCommandOutput/)
+
+ +ListAsyncInvokes + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock-runtime/command/ListAsyncInvokesCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-runtime/Interface/ListAsyncInvokesCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-runtime/Interface/ListAsyncInvokesCommandOutput/) + +
+
+ +StartAsyncInvoke + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock-runtime/command/StartAsyncInvokeCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-runtime/Interface/StartAsyncInvokeCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-runtime/Interface/StartAsyncInvokeCommandOutput/) + +
diff --git a/clients/client-bedrock-runtime/package.json b/clients/client-bedrock-runtime/package.json index 78e42eb8ee33..cff06450148a 100644 --- a/clients/client-bedrock-runtime/package.json +++ b/clients/client-bedrock-runtime/package.json @@ -62,7 +62,9 @@ "@smithy/util-retry": "^3.0.10", "@smithy/util-stream": "^3.3.1", "@smithy/util-utf8": "^3.0.0", - "tslib": "^2.6.2" + "@types/uuid": "^9.0.1", + "tslib": "^2.6.2", + "uuid": "^9.0.1" }, "devDependencies": { "@tsconfig/node16": "16.1.3", diff --git a/clients/client-bedrock-runtime/src/BedrockRuntime.ts b/clients/client-bedrock-runtime/src/BedrockRuntime.ts index d69c6eb0a735..a5f98beda7f1 100644 --- a/clients/client-bedrock-runtime/src/BedrockRuntime.ts +++ b/clients/client-bedrock-runtime/src/BedrockRuntime.ts @@ -14,19 +14,37 @@ import { ConverseStreamCommandInput, ConverseStreamCommandOutput, } from "./commands/ConverseStreamCommand"; +import { + GetAsyncInvokeCommand, + GetAsyncInvokeCommandInput, + GetAsyncInvokeCommandOutput, +} from "./commands/GetAsyncInvokeCommand"; import { InvokeModelCommand, InvokeModelCommandInput, InvokeModelCommandOutput } from "./commands/InvokeModelCommand"; import { InvokeModelWithResponseStreamCommand, InvokeModelWithResponseStreamCommandInput, InvokeModelWithResponseStreamCommandOutput, } from "./commands/InvokeModelWithResponseStreamCommand"; +import { + ListAsyncInvokesCommand, + ListAsyncInvokesCommandInput, + ListAsyncInvokesCommandOutput, +} from "./commands/ListAsyncInvokesCommand"; +import { + StartAsyncInvokeCommand, + StartAsyncInvokeCommandInput, + StartAsyncInvokeCommandOutput, +} from "./commands/StartAsyncInvokeCommand"; const commands = { ApplyGuardrailCommand, ConverseCommand, ConverseStreamCommand, + GetAsyncInvokeCommand, InvokeModelCommand, InvokeModelWithResponseStreamCommand, + ListAsyncInvokesCommand, + StartAsyncInvokeCommand, }; export interface BedrockRuntime { @@ -69,6 +87,20 @@ export interface BedrockRuntime { cb: (err: any, data?: ConverseStreamCommandOutput) => void ): void; + /** + * @see {@link GetAsyncInvokeCommand} + */ + getAsyncInvoke( + args: GetAsyncInvokeCommandInput, + options?: __HttpHandlerOptions + ): Promise; + getAsyncInvoke(args: GetAsyncInvokeCommandInput, cb: (err: any, data?: GetAsyncInvokeCommandOutput) => void): void; + getAsyncInvoke( + args: GetAsyncInvokeCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: GetAsyncInvokeCommandOutput) => void + ): void; + /** * @see {@link InvokeModelCommand} */ @@ -96,6 +128,41 @@ export interface BedrockRuntime { options: __HttpHandlerOptions, cb: (err: any, data?: InvokeModelWithResponseStreamCommandOutput) => void ): void; + + /** + * @see {@link ListAsyncInvokesCommand} + */ + listAsyncInvokes(): Promise; + listAsyncInvokes( + args: ListAsyncInvokesCommandInput, + options?: __HttpHandlerOptions + ): Promise; + listAsyncInvokes( + args: ListAsyncInvokesCommandInput, + cb: (err: any, data?: ListAsyncInvokesCommandOutput) => void + ): void; + listAsyncInvokes( + args: ListAsyncInvokesCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: ListAsyncInvokesCommandOutput) => void + ): void; + + /** + * @see {@link StartAsyncInvokeCommand} + */ + startAsyncInvoke( + args: StartAsyncInvokeCommandInput, + options?: __HttpHandlerOptions + ): Promise; + startAsyncInvoke( + args: StartAsyncInvokeCommandInput, + cb: (err: any, data?: StartAsyncInvokeCommandOutput) => void + ): void; + startAsyncInvoke( + args: StartAsyncInvokeCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: StartAsyncInvokeCommandOutput) => void + ): void; } /** diff --git a/clients/client-bedrock-runtime/src/BedrockRuntimeClient.ts b/clients/client-bedrock-runtime/src/BedrockRuntimeClient.ts index 96e3fd58c960..5d25f32c696d 100644 --- a/clients/client-bedrock-runtime/src/BedrockRuntimeClient.ts +++ b/clients/client-bedrock-runtime/src/BedrockRuntimeClient.ts @@ -62,11 +62,14 @@ import { import { ApplyGuardrailCommandInput, ApplyGuardrailCommandOutput } from "./commands/ApplyGuardrailCommand"; import { ConverseCommandInput, ConverseCommandOutput } from "./commands/ConverseCommand"; import { ConverseStreamCommandInput, ConverseStreamCommandOutput } from "./commands/ConverseStreamCommand"; +import { GetAsyncInvokeCommandInput, GetAsyncInvokeCommandOutput } from "./commands/GetAsyncInvokeCommand"; import { InvokeModelCommandInput, InvokeModelCommandOutput } from "./commands/InvokeModelCommand"; import { InvokeModelWithResponseStreamCommandInput, InvokeModelWithResponseStreamCommandOutput, } from "./commands/InvokeModelWithResponseStreamCommand"; +import { ListAsyncInvokesCommandInput, ListAsyncInvokesCommandOutput } from "./commands/ListAsyncInvokesCommand"; +import { StartAsyncInvokeCommandInput, StartAsyncInvokeCommandOutput } from "./commands/StartAsyncInvokeCommand"; import { ClientInputEndpointParameters, ClientResolvedEndpointParameters, @@ -85,8 +88,11 @@ export type ServiceInputTypes = | ApplyGuardrailCommandInput | ConverseCommandInput | ConverseStreamCommandInput + | GetAsyncInvokeCommandInput | InvokeModelCommandInput - | InvokeModelWithResponseStreamCommandInput; + | InvokeModelWithResponseStreamCommandInput + | ListAsyncInvokesCommandInput + | StartAsyncInvokeCommandInput; /** * @public @@ -95,8 +101,11 @@ export type ServiceOutputTypes = | ApplyGuardrailCommandOutput | ConverseCommandOutput | ConverseStreamCommandOutput + | GetAsyncInvokeCommandOutput | InvokeModelCommandOutput - | InvokeModelWithResponseStreamCommandOutput; + | InvokeModelWithResponseStreamCommandOutput + | ListAsyncInvokesCommandOutput + | StartAsyncInvokeCommandOutput; /** * @public diff --git a/clients/client-bedrock-runtime/src/commands/ApplyGuardrailCommand.ts b/clients/client-bedrock-runtime/src/commands/ApplyGuardrailCommand.ts index ff7d73a5efa0..fb492fdb98d8 100644 --- a/clients/client-bedrock-runtime/src/commands/ApplyGuardrailCommand.ts +++ b/clients/client-bedrock-runtime/src/commands/ApplyGuardrailCommand.ts @@ -29,6 +29,8 @@ export interface ApplyGuardrailCommandOutput extends ApplyGuardrailResponse, __M /** *

The action to apply a guardrail.

+ *

For troubleshooting some of the common errors you might encounter when using the ApplyGuardrail API, + * see Troubleshooting Amazon Bedrock API Error Codes in the Amazon Bedrock User Guide

* @example * Use a bare-bones client and the command you need to make an API call. * ```javascript diff --git a/clients/client-bedrock-runtime/src/commands/ConverseCommand.ts b/clients/client-bedrock-runtime/src/commands/ConverseCommand.ts index 1dd57f863c03..50679f59b2e9 100644 --- a/clients/client-bedrock-runtime/src/commands/ConverseCommand.ts +++ b/clients/client-bedrock-runtime/src/commands/ConverseCommand.ts @@ -79,6 +79,16 @@ export interface ConverseCommandOutput extends ConverseResponse, __MetadataBeare * bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("") * }, * }, + * video: { // VideoBlock + * format: "mkv" || "mov" || "mp4" || "webm" || "flv" || "mpeg" || "mpg" || "wmv" || "three_gp", // required + * source: { // VideoSource Union: only one key present + * bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("") + * s3Location: { // S3Location + * uri: "STRING_VALUE", // required + * bucketOwner: "STRING_VALUE", + * }, + * }, + * }, * toolUse: { // ToolUseBlock * toolUseId: "STRING_VALUE", // required * name: "STRING_VALUE", // required @@ -103,6 +113,16 @@ export interface ConverseCommandOutput extends ConverseResponse, __MetadataBeare * bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("") * }, * }, + * video: { + * format: "mkv" || "mov" || "mp4" || "webm" || "flv" || "mpeg" || "mpg" || "wmv" || "three_gp", // required + * source: {// Union: only one key present + * bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("") + * s3Location: { + * uri: "STRING_VALUE", // required + * bucketOwner: "STRING_VALUE", + * }, + * }, + * }, * }, * ], * status: "success" || "error", @@ -174,6 +194,9 @@ export interface ConverseCommandOutput extends ConverseResponse, __MetadataBeare * additionalModelResponseFieldPaths: [ // AdditionalModelResponseFieldPaths * "STRING_VALUE", * ], + * requestMetadata: { // RequestMetadata + * "": "STRING_VALUE", + * }, * performanceConfig: { // PerformanceConfiguration * latency: "standard" || "optimized", * }, @@ -200,6 +223,16 @@ export interface ConverseCommandOutput extends ConverseResponse, __MetadataBeare * // bytes: new Uint8Array(), * // }, * // }, + * // video: { // VideoBlock + * // format: "mkv" || "mov" || "mp4" || "webm" || "flv" || "mpeg" || "mpg" || "wmv" || "three_gp", // required + * // source: { // VideoSource Union: only one key present + * // bytes: new Uint8Array(), + * // s3Location: { // S3Location + * // uri: "STRING_VALUE", // required + * // bucketOwner: "STRING_VALUE", + * // }, + * // }, + * // }, * // toolUse: { // ToolUseBlock * // toolUseId: "STRING_VALUE", // required * // name: "STRING_VALUE", // required @@ -224,6 +257,16 @@ export interface ConverseCommandOutput extends ConverseResponse, __MetadataBeare * // bytes: new Uint8Array(), * // }, * // }, + * // video: { + * // format: "mkv" || "mov" || "mp4" || "webm" || "flv" || "mpeg" || "mpg" || "wmv" || "three_gp", // required + * // source: {// Union: only one key present + * // bytes: new Uint8Array(), + * // s3Location: { + * // uri: "STRING_VALUE", // required + * // bucketOwner: "STRING_VALUE", + * // }, + * // }, + * // }, * // }, * // ], * // status: "success" || "error", diff --git a/clients/client-bedrock-runtime/src/commands/ConverseStreamCommand.ts b/clients/client-bedrock-runtime/src/commands/ConverseStreamCommand.ts index 31ba6c2403d8..c42c37d51941 100644 --- a/clients/client-bedrock-runtime/src/commands/ConverseStreamCommand.ts +++ b/clients/client-bedrock-runtime/src/commands/ConverseStreamCommand.ts @@ -90,6 +90,16 @@ export interface ConverseStreamCommandOutput extends ConverseStreamResponse, __M * bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("") * }, * }, + * video: { // VideoBlock + * format: "mkv" || "mov" || "mp4" || "webm" || "flv" || "mpeg" || "mpg" || "wmv" || "three_gp", // required + * source: { // VideoSource Union: only one key present + * bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("") + * s3Location: { // S3Location + * uri: "STRING_VALUE", // required + * bucketOwner: "STRING_VALUE", + * }, + * }, + * }, * toolUse: { // ToolUseBlock * toolUseId: "STRING_VALUE", // required * name: "STRING_VALUE", // required @@ -114,6 +124,16 @@ export interface ConverseStreamCommandOutput extends ConverseStreamResponse, __M * bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("") * }, * }, + * video: { + * format: "mkv" || "mov" || "mp4" || "webm" || "flv" || "mpeg" || "mpg" || "wmv" || "three_gp", // required + * source: {// Union: only one key present + * bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("") + * s3Location: { + * uri: "STRING_VALUE", // required + * bucketOwner: "STRING_VALUE", + * }, + * }, + * }, * }, * ], * status: "success" || "error", @@ -186,6 +206,9 @@ export interface ConverseStreamCommandOutput extends ConverseStreamResponse, __M * additionalModelResponseFieldPaths: [ // AdditionalModelResponseFieldPaths * "STRING_VALUE", * ], + * requestMetadata: { // RequestMetadata + * "": "STRING_VALUE", + * }, * performanceConfig: { // PerformanceConfiguration * latency: "standard" || "optimized", * }, diff --git a/clients/client-bedrock-runtime/src/commands/GetAsyncInvokeCommand.ts b/clients/client-bedrock-runtime/src/commands/GetAsyncInvokeCommand.ts new file mode 100644 index 000000000000..860d164a95d7 --- /dev/null +++ b/clients/client-bedrock-runtime/src/commands/GetAsyncInvokeCommand.ts @@ -0,0 +1,126 @@ +// 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 { BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../BedrockRuntimeClient"; +import { commonParams } from "../endpoint/EndpointParameters"; +import { + GetAsyncInvokeRequest, + GetAsyncInvokeResponse, + GetAsyncInvokeResponseFilterSensitiveLog, +} from "../models/models_0"; +import { de_GetAsyncInvokeCommand, se_GetAsyncInvokeCommand } from "../protocols/Aws_restJson1"; + +/** + * @public + */ +export type { __MetadataBearer }; +export { $Command }; +/** + * @public + * + * The input for {@link GetAsyncInvokeCommand}. + */ +export interface GetAsyncInvokeCommandInput extends GetAsyncInvokeRequest {} +/** + * @public + * + * The output of {@link GetAsyncInvokeCommand}. + */ +export interface GetAsyncInvokeCommandOutput extends GetAsyncInvokeResponse, __MetadataBearer {} + +/** + *

Retrieve information about an asynchronous invocation.

+ * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { BedrockRuntimeClient, GetAsyncInvokeCommand } from "@aws-sdk/client-bedrock-runtime"; // ES Modules import + * // const { BedrockRuntimeClient, GetAsyncInvokeCommand } = require("@aws-sdk/client-bedrock-runtime"); // CommonJS import + * const client = new BedrockRuntimeClient(config); + * const input = { // GetAsyncInvokeRequest + * invocationArn: "STRING_VALUE", // required + * }; + * const command = new GetAsyncInvokeCommand(input); + * const response = await client.send(command); + * // { // GetAsyncInvokeResponse + * // invocationArn: "STRING_VALUE", // required + * // modelArn: "STRING_VALUE", // required + * // clientRequestToken: "STRING_VALUE", + * // status: "InProgress" || "Completed" || "Failed", // required + * // failureMessage: "STRING_VALUE", + * // submitTime: new Date("TIMESTAMP"), // required + * // lastModifiedTime: new Date("TIMESTAMP"), + * // endTime: new Date("TIMESTAMP"), + * // outputDataConfig: { // AsyncInvokeOutputDataConfig Union: only one key present + * // s3OutputDataConfig: { // AsyncInvokeS3OutputDataConfig + * // s3Uri: "STRING_VALUE", // required + * // kmsKeyId: "STRING_VALUE", + * // bucketOwner: "STRING_VALUE", + * // }, + * // }, + * // }; + * + * ``` + * + * @param GetAsyncInvokeCommandInput - {@link GetAsyncInvokeCommandInput} + * @returns {@link GetAsyncInvokeCommandOutput} + * @see {@link GetAsyncInvokeCommandInput} for command's `input` shape. + * @see {@link GetAsyncInvokeCommandOutput} for command's `response` shape. + * @see {@link BedrockRuntimeClientResolvedConfig | config} for BedrockRuntimeClient's `config` shape. + * + * @throws {@link AccessDeniedException} (client fault) + *

The request is denied because you do not have sufficient permissions to perform the requested action. For troubleshooting this error, + * see AccessDeniedException in the Amazon Bedrock User Guide

+ * + * @throws {@link InternalServerException} (server fault) + *

An internal server error occurred. For troubleshooting this error, + * see InternalFailure in the Amazon Bedrock User Guide

+ * + * @throws {@link ThrottlingException} (client fault) + *

Your request was denied due to exceeding the account quotas for Amazon Bedrock. For + * troubleshooting this error, see ThrottlingException in the Amazon Bedrock User Guide

+ * + * @throws {@link ValidationException} (client fault) + *

The input fails to satisfy the constraints specified by Amazon Bedrock. For troubleshooting this error, + * see ValidationError in the Amazon Bedrock User Guide

+ * + * @throws {@link BedrockRuntimeServiceException} + *

Base exception class for all service exceptions from BedrockRuntime service.

+ * + * @public + */ +export class GetAsyncInvokeCommand extends $Command + .classBuilder< + GetAsyncInvokeCommandInput, + GetAsyncInvokeCommandOutput, + BedrockRuntimeClientResolvedConfig, + ServiceInputTypes, + ServiceOutputTypes + >() + .ep(commonParams) + .m(function (this: any, Command: any, cs: any, config: BedrockRuntimeClientResolvedConfig, o: any) { + return [ + getSerdePlugin(config, this.serialize, this.deserialize), + getEndpointPlugin(config, Command.getEndpointParameterInstructions()), + ]; + }) + .s("AmazonBedrockFrontendService", "GetAsyncInvoke", {}) + .n("BedrockRuntimeClient", "GetAsyncInvokeCommand") + .f(void 0, GetAsyncInvokeResponseFilterSensitiveLog) + .ser(se_GetAsyncInvokeCommand) + .de(de_GetAsyncInvokeCommand) + .build() { + /** @internal type navigation helper, not in runtime. */ + protected declare static __types: { + api: { + input: GetAsyncInvokeRequest; + output: GetAsyncInvokeResponse; + }; + sdk: { + input: GetAsyncInvokeCommandInput; + output: GetAsyncInvokeCommandOutput; + }; + }; +} diff --git a/clients/client-bedrock-runtime/src/commands/ListAsyncInvokesCommand.ts b/clients/client-bedrock-runtime/src/commands/ListAsyncInvokesCommand.ts new file mode 100644 index 000000000000..1a753a74f7a4 --- /dev/null +++ b/clients/client-bedrock-runtime/src/commands/ListAsyncInvokesCommand.ts @@ -0,0 +1,137 @@ +// 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 { BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../BedrockRuntimeClient"; +import { commonParams } from "../endpoint/EndpointParameters"; +import { + ListAsyncInvokesRequest, + ListAsyncInvokesResponse, + ListAsyncInvokesResponseFilterSensitiveLog, +} from "../models/models_0"; +import { de_ListAsyncInvokesCommand, se_ListAsyncInvokesCommand } from "../protocols/Aws_restJson1"; + +/** + * @public + */ +export type { __MetadataBearer }; +export { $Command }; +/** + * @public + * + * The input for {@link ListAsyncInvokesCommand}. + */ +export interface ListAsyncInvokesCommandInput extends ListAsyncInvokesRequest {} +/** + * @public + * + * The output of {@link ListAsyncInvokesCommand}. + */ +export interface ListAsyncInvokesCommandOutput extends ListAsyncInvokesResponse, __MetadataBearer {} + +/** + *

Lists asynchronous invocations.

+ * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { BedrockRuntimeClient, ListAsyncInvokesCommand } from "@aws-sdk/client-bedrock-runtime"; // ES Modules import + * // const { BedrockRuntimeClient, ListAsyncInvokesCommand } = require("@aws-sdk/client-bedrock-runtime"); // CommonJS import + * const client = new BedrockRuntimeClient(config); + * const input = { // ListAsyncInvokesRequest + * submitTimeAfter: new Date("TIMESTAMP"), + * submitTimeBefore: new Date("TIMESTAMP"), + * statusEquals: "InProgress" || "Completed" || "Failed", + * maxResults: Number("int"), + * nextToken: "STRING_VALUE", + * sortBy: "SubmissionTime", + * sortOrder: "Ascending" || "Descending", + * }; + * const command = new ListAsyncInvokesCommand(input); + * const response = await client.send(command); + * // { // ListAsyncInvokesResponse + * // nextToken: "STRING_VALUE", + * // asyncInvokeSummaries: [ // AsyncInvokeSummaries + * // { // AsyncInvokeSummary + * // invocationArn: "STRING_VALUE", // required + * // modelArn: "STRING_VALUE", // required + * // clientRequestToken: "STRING_VALUE", + * // status: "InProgress" || "Completed" || "Failed", + * // failureMessage: "STRING_VALUE", + * // submitTime: new Date("TIMESTAMP"), // required + * // lastModifiedTime: new Date("TIMESTAMP"), + * // endTime: new Date("TIMESTAMP"), + * // outputDataConfig: { // AsyncInvokeOutputDataConfig Union: only one key present + * // s3OutputDataConfig: { // AsyncInvokeS3OutputDataConfig + * // s3Uri: "STRING_VALUE", // required + * // kmsKeyId: "STRING_VALUE", + * // bucketOwner: "STRING_VALUE", + * // }, + * // }, + * // }, + * // ], + * // }; + * + * ``` + * + * @param ListAsyncInvokesCommandInput - {@link ListAsyncInvokesCommandInput} + * @returns {@link ListAsyncInvokesCommandOutput} + * @see {@link ListAsyncInvokesCommandInput} for command's `input` shape. + * @see {@link ListAsyncInvokesCommandOutput} for command's `response` shape. + * @see {@link BedrockRuntimeClientResolvedConfig | config} for BedrockRuntimeClient's `config` shape. + * + * @throws {@link AccessDeniedException} (client fault) + *

The request is denied because you do not have sufficient permissions to perform the requested action. For troubleshooting this error, + * see AccessDeniedException in the Amazon Bedrock User Guide

+ * + * @throws {@link InternalServerException} (server fault) + *

An internal server error occurred. For troubleshooting this error, + * see InternalFailure in the Amazon Bedrock User Guide

+ * + * @throws {@link ThrottlingException} (client fault) + *

Your request was denied due to exceeding the account quotas for Amazon Bedrock. For + * troubleshooting this error, see ThrottlingException in the Amazon Bedrock User Guide

+ * + * @throws {@link ValidationException} (client fault) + *

The input fails to satisfy the constraints specified by Amazon Bedrock. For troubleshooting this error, + * see ValidationError in the Amazon Bedrock User Guide

+ * + * @throws {@link BedrockRuntimeServiceException} + *

Base exception class for all service exceptions from BedrockRuntime service.

+ * + * @public + */ +export class ListAsyncInvokesCommand extends $Command + .classBuilder< + ListAsyncInvokesCommandInput, + ListAsyncInvokesCommandOutput, + BedrockRuntimeClientResolvedConfig, + ServiceInputTypes, + ServiceOutputTypes + >() + .ep(commonParams) + .m(function (this: any, Command: any, cs: any, config: BedrockRuntimeClientResolvedConfig, o: any) { + return [ + getSerdePlugin(config, this.serialize, this.deserialize), + getEndpointPlugin(config, Command.getEndpointParameterInstructions()), + ]; + }) + .s("AmazonBedrockFrontendService", "ListAsyncInvokes", {}) + .n("BedrockRuntimeClient", "ListAsyncInvokesCommand") + .f(void 0, ListAsyncInvokesResponseFilterSensitiveLog) + .ser(se_ListAsyncInvokesCommand) + .de(de_ListAsyncInvokesCommand) + .build() { + /** @internal type navigation helper, not in runtime. */ + protected declare static __types: { + api: { + input: ListAsyncInvokesRequest; + output: ListAsyncInvokesResponse; + }; + sdk: { + input: ListAsyncInvokesCommandInput; + output: ListAsyncInvokesCommandOutput; + }; + }; +} diff --git a/clients/client-bedrock-runtime/src/commands/StartAsyncInvokeCommand.ts b/clients/client-bedrock-runtime/src/commands/StartAsyncInvokeCommand.ts new file mode 100644 index 000000000000..981ae8fef52d --- /dev/null +++ b/clients/client-bedrock-runtime/src/commands/StartAsyncInvokeCommand.ts @@ -0,0 +1,149 @@ +// 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 { BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../BedrockRuntimeClient"; +import { commonParams } from "../endpoint/EndpointParameters"; +import { + StartAsyncInvokeRequest, + StartAsyncInvokeRequestFilterSensitiveLog, + StartAsyncInvokeResponse, +} from "../models/models_0"; +import { de_StartAsyncInvokeCommand, se_StartAsyncInvokeCommand } from "../protocols/Aws_restJson1"; + +/** + * @public + */ +export type { __MetadataBearer }; +export { $Command }; +/** + * @public + * + * The input for {@link StartAsyncInvokeCommand}. + */ +export interface StartAsyncInvokeCommandInput extends StartAsyncInvokeRequest {} +/** + * @public + * + * The output of {@link StartAsyncInvokeCommand}. + */ +export interface StartAsyncInvokeCommandOutput extends StartAsyncInvokeResponse, __MetadataBearer {} + +/** + *

Starts an asynchronous invocation.

+ *

This operation requires permission for the bedrock:InvokeModel action.

+ * + *

To deny all inference access to resources that you specify in the modelId field, you + * need to deny access to the bedrock:InvokeModel and + * bedrock:InvokeModelWithResponseStream actions. Doing this also denies + * access to the resource through the Converse API actions (Converse and ConverseStream). For more information see Deny access for inference on specific models. + *

+ *
+ * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { BedrockRuntimeClient, StartAsyncInvokeCommand } from "@aws-sdk/client-bedrock-runtime"; // ES Modules import + * // const { BedrockRuntimeClient, StartAsyncInvokeCommand } = require("@aws-sdk/client-bedrock-runtime"); // CommonJS import + * const client = new BedrockRuntimeClient(config); + * const input = { // StartAsyncInvokeRequest + * clientRequestToken: "STRING_VALUE", + * modelId: "STRING_VALUE", // required + * modelInput: "DOCUMENT_VALUE", // required + * outputDataConfig: { // AsyncInvokeOutputDataConfig Union: only one key present + * s3OutputDataConfig: { // AsyncInvokeS3OutputDataConfig + * s3Uri: "STRING_VALUE", // required + * kmsKeyId: "STRING_VALUE", + * bucketOwner: "STRING_VALUE", + * }, + * }, + * tags: [ // TagList + * { // Tag + * key: "STRING_VALUE", // required + * value: "STRING_VALUE", // required + * }, + * ], + * }; + * const command = new StartAsyncInvokeCommand(input); + * const response = await client.send(command); + * // { // StartAsyncInvokeResponse + * // invocationArn: "STRING_VALUE", // required + * // }; + * + * ``` + * + * @param StartAsyncInvokeCommandInput - {@link StartAsyncInvokeCommandInput} + * @returns {@link StartAsyncInvokeCommandOutput} + * @see {@link StartAsyncInvokeCommandInput} for command's `input` shape. + * @see {@link StartAsyncInvokeCommandOutput} for command's `response` shape. + * @see {@link BedrockRuntimeClientResolvedConfig | config} for BedrockRuntimeClient's `config` shape. + * + * @throws {@link AccessDeniedException} (client fault) + *

The request is denied because you do not have sufficient permissions to perform the requested action. For troubleshooting this error, + * see AccessDeniedException in the Amazon Bedrock User Guide

+ * + * @throws {@link ConflictException} (client fault) + *

Error occurred because of a conflict while performing an operation.

+ * + * @throws {@link InternalServerException} (server fault) + *

An internal server error occurred. For troubleshooting this error, + * see InternalFailure in the Amazon Bedrock User Guide

+ * + * @throws {@link ResourceNotFoundException} (client fault) + *

The specified resource ARN was not found. For troubleshooting this error, + * see ResourceNotFound in the Amazon Bedrock User Guide

+ * + * @throws {@link ServiceQuotaExceededException} (client fault) + *

Your request exceeds the service quota for your account. You can view your quotas at Viewing service quotas. You can resubmit your request later.

+ * + * @throws {@link ServiceUnavailableException} (server fault) + *

The service isn't currently available. For troubleshooting this error, + * see ServiceUnavailable in the Amazon Bedrock User Guide

+ * + * @throws {@link ThrottlingException} (client fault) + *

Your request was denied due to exceeding the account quotas for Amazon Bedrock. For + * troubleshooting this error, see ThrottlingException in the Amazon Bedrock User Guide

+ * + * @throws {@link ValidationException} (client fault) + *

The input fails to satisfy the constraints specified by Amazon Bedrock. For troubleshooting this error, + * see ValidationError in the Amazon Bedrock User Guide

+ * + * @throws {@link BedrockRuntimeServiceException} + *

Base exception class for all service exceptions from BedrockRuntime service.

+ * + * @public + */ +export class StartAsyncInvokeCommand extends $Command + .classBuilder< + StartAsyncInvokeCommandInput, + StartAsyncInvokeCommandOutput, + BedrockRuntimeClientResolvedConfig, + ServiceInputTypes, + ServiceOutputTypes + >() + .ep(commonParams) + .m(function (this: any, Command: any, cs: any, config: BedrockRuntimeClientResolvedConfig, o: any) { + return [ + getSerdePlugin(config, this.serialize, this.deserialize), + getEndpointPlugin(config, Command.getEndpointParameterInstructions()), + ]; + }) + .s("AmazonBedrockFrontendService", "StartAsyncInvoke", {}) + .n("BedrockRuntimeClient", "StartAsyncInvokeCommand") + .f(StartAsyncInvokeRequestFilterSensitiveLog, void 0) + .ser(se_StartAsyncInvokeCommand) + .de(de_StartAsyncInvokeCommand) + .build() { + /** @internal type navigation helper, not in runtime. */ + protected declare static __types: { + api: { + input: StartAsyncInvokeRequest; + output: StartAsyncInvokeResponse; + }; + sdk: { + input: StartAsyncInvokeCommandInput; + output: StartAsyncInvokeCommandOutput; + }; + }; +} diff --git a/clients/client-bedrock-runtime/src/commands/index.ts b/clients/client-bedrock-runtime/src/commands/index.ts index d8eed6a0bb8a..804caf03e485 100644 --- a/clients/client-bedrock-runtime/src/commands/index.ts +++ b/clients/client-bedrock-runtime/src/commands/index.ts @@ -2,5 +2,8 @@ export * from "./ApplyGuardrailCommand"; export * from "./ConverseCommand"; export * from "./ConverseStreamCommand"; +export * from "./GetAsyncInvokeCommand"; export * from "./InvokeModelCommand"; export * from "./InvokeModelWithResponseStreamCommand"; +export * from "./ListAsyncInvokesCommand"; +export * from "./StartAsyncInvokeCommand"; diff --git a/clients/client-bedrock-runtime/src/index.ts b/clients/client-bedrock-runtime/src/index.ts index a1ffa0fe0a91..e38159742cba 100644 --- a/clients/client-bedrock-runtime/src/index.ts +++ b/clients/client-bedrock-runtime/src/index.ts @@ -11,6 +11,7 @@ export { ClientInputEndpointParameters } from "./endpoint/EndpointParameters"; export type { RuntimeExtension } from "./runtimeExtensions"; export type { BedrockRuntimeExtensionConfiguration } from "./extensionConfiguration"; export * from "./commands"; +export * from "./pagination"; export * from "./models"; export { BedrockRuntimeServiceException } from "./models/BedrockRuntimeServiceException"; diff --git a/clients/client-bedrock-runtime/src/models/models_0.ts b/clients/client-bedrock-runtime/src/models/models_0.ts index b8a21d82e18f..01e85425ce37 100644 --- a/clients/client-bedrock-runtime/src/models/models_0.ts +++ b/clients/client-bedrock-runtime/src/models/models_0.ts @@ -26,6 +26,515 @@ export class AccessDeniedException extends __BaseException { } } +/** + * @public + */ +export interface GetAsyncInvokeRequest { + /** + *

The invocation's ARN.

+ * @public + */ + invocationArn: string | undefined; +} + +/** + *

Asynchronous invocation output data settings.

+ * @public + */ +export interface AsyncInvokeS3OutputDataConfig { + /** + *

An object URI starting with s3://.

+ * @public + */ + s3Uri: string | undefined; + + /** + *

A KMS encryption key ID.

+ * @public + */ + kmsKeyId?: string | undefined; + + /** + *

If the bucket belongs to another AWS account, specify that account's ID.

+ * @public + */ + bucketOwner?: string | undefined; +} + +/** + *

Asynchronous invocation output data settings.

+ * @public + */ +export type AsyncInvokeOutputDataConfig = + | AsyncInvokeOutputDataConfig.S3OutputDataConfigMember + | AsyncInvokeOutputDataConfig.$UnknownMember; + +/** + * @public + */ +export namespace AsyncInvokeOutputDataConfig { + /** + *

A storage location for the output data in an S3 bucket

+ * @public + */ + export interface S3OutputDataConfigMember { + s3OutputDataConfig: AsyncInvokeS3OutputDataConfig; + $unknown?: never; + } + + /** + * @public + */ + export interface $UnknownMember { + s3OutputDataConfig?: never; + $unknown: [string, any]; + } + + export interface Visitor { + s3OutputDataConfig: (value: AsyncInvokeS3OutputDataConfig) => T; + _: (name: string, value: any) => T; + } + + export const visit = (value: AsyncInvokeOutputDataConfig, visitor: Visitor): T => { + if (value.s3OutputDataConfig !== undefined) return visitor.s3OutputDataConfig(value.s3OutputDataConfig); + return visitor._(value.$unknown[0], value.$unknown[1]); + }; +} + +/** + * @public + * @enum + */ +export const AsyncInvokeStatus = { + COMPLETED: "Completed", + FAILED: "Failed", + IN_PROGRESS: "InProgress", +} as const; + +/** + * @public + */ +export type AsyncInvokeStatus = (typeof AsyncInvokeStatus)[keyof typeof AsyncInvokeStatus]; + +/** + * @public + */ +export interface GetAsyncInvokeResponse { + /** + *

The invocation's ARN.

+ * @public + */ + invocationArn: string | undefined; + + /** + *

The invocation's model ARN.

+ * @public + */ + modelArn: string | undefined; + + /** + *

The invocation's idempotency token.

+ * @public + */ + clientRequestToken?: string | undefined; + + /** + *

The invocation's status.

+ * @public + */ + status: AsyncInvokeStatus | undefined; + + /** + *

An error message.

+ * @public + */ + failureMessage?: string | undefined; + + /** + *

When the invocation request was submitted.

+ * @public + */ + submitTime: Date | undefined; + + /** + *

The invocation's last modified time.

+ * @public + */ + lastModifiedTime?: Date | undefined; + + /** + *

When the invocation ended.

+ * @public + */ + endTime?: Date | undefined; + + /** + *

Output data settings.

+ * @public + */ + outputDataConfig: AsyncInvokeOutputDataConfig | undefined; +} + +/** + *

An internal server error occurred. For troubleshooting this error, + * see InternalFailure in the Amazon Bedrock User Guide

+ * @public + */ +export class InternalServerException extends __BaseException { + readonly name: "InternalServerException" = "InternalServerException"; + readonly $fault: "server" = "server"; + /** + * @internal + */ + constructor(opts: __ExceptionOptionType) { + super({ + name: "InternalServerException", + $fault: "server", + ...opts, + }); + Object.setPrototypeOf(this, InternalServerException.prototype); + } +} + +/** + *

Your request was denied due to exceeding the account quotas for Amazon Bedrock. For + * troubleshooting this error, see ThrottlingException in the Amazon Bedrock User Guide

+ * @public + */ +export class ThrottlingException extends __BaseException { + readonly name: "ThrottlingException" = "ThrottlingException"; + readonly $fault: "client" = "client"; + /** + * @internal + */ + constructor(opts: __ExceptionOptionType) { + super({ + name: "ThrottlingException", + $fault: "client", + ...opts, + }); + Object.setPrototypeOf(this, ThrottlingException.prototype); + } +} + +/** + *

The input fails to satisfy the constraints specified by Amazon Bedrock. For troubleshooting this error, + * see ValidationError in the Amazon Bedrock User Guide

+ * @public + */ +export class ValidationException extends __BaseException { + readonly name: "ValidationException" = "ValidationException"; + readonly $fault: "client" = "client"; + /** + * @internal + */ + constructor(opts: __ExceptionOptionType) { + super({ + name: "ValidationException", + $fault: "client", + ...opts, + }); + Object.setPrototypeOf(this, ValidationException.prototype); + } +} + +/** + * @public + * @enum + */ +export const SortAsyncInvocationBy = { + SUBMISSION_TIME: "SubmissionTime", +} as const; + +/** + * @public + */ +export type SortAsyncInvocationBy = (typeof SortAsyncInvocationBy)[keyof typeof SortAsyncInvocationBy]; + +/** + * @public + * @enum + */ +export const SortOrder = { + ASCENDING: "Ascending", + DESCENDING: "Descending", +} as const; + +/** + * @public + */ +export type SortOrder = (typeof SortOrder)[keyof typeof SortOrder]; + +/** + * @public + */ +export interface ListAsyncInvokesRequest { + /** + *

Include invocations submitted after this time.

+ * @public + */ + submitTimeAfter?: Date | undefined; + + /** + *

Include invocations submitted before this time.

+ * @public + */ + submitTimeBefore?: Date | undefined; + + /** + *

Filter invocations by status.

+ * @public + */ + statusEquals?: AsyncInvokeStatus | undefined; + + /** + *

The maximum number of invocations to return in one page of results.

+ * @public + */ + maxResults?: number | undefined; + + /** + *

Specify the pagination token from a previous request to retrieve the next page of results.

+ * @public + */ + nextToken?: string | undefined; + + /** + *

How to sort the response.

+ * @public + */ + sortBy?: SortAsyncInvocationBy | undefined; + + /** + *

The sorting order for the response.

+ * @public + */ + sortOrder?: SortOrder | undefined; +} + +/** + *

A summary of an asynchronous invocation.

+ * @public + */ +export interface AsyncInvokeSummary { + /** + *

The invocation's ARN.

+ * @public + */ + invocationArn: string | undefined; + + /** + *

The invoked model's ARN.

+ * @public + */ + modelArn: string | undefined; + + /** + *

The invocation's idempotency token.

+ * @public + */ + clientRequestToken?: string | undefined; + + /** + *

The invocation's status.

+ * @public + */ + status?: AsyncInvokeStatus | undefined; + + /** + *

An error message.

+ * @public + */ + failureMessage?: string | undefined; + + /** + *

When the invocation was submitted.

+ * @public + */ + submitTime: Date | undefined; + + /** + *

When the invocation was last modified.

+ * @public + */ + lastModifiedTime?: Date | undefined; + + /** + *

When the invocation ended.

+ * @public + */ + endTime?: Date | undefined; + + /** + *

The invocation's output data settings.

+ * @public + */ + outputDataConfig: AsyncInvokeOutputDataConfig | undefined; +} + +/** + * @public + */ +export interface ListAsyncInvokesResponse { + /** + *

Specify the pagination token from a previous request to retrieve the next page of results.

+ * @public + */ + nextToken?: string | undefined; + + /** + *

A list of invocation summaries.

+ * @public + */ + asyncInvokeSummaries?: AsyncInvokeSummary[] | undefined; +} + +/** + *

Error occurred because of a conflict while performing an operation.

+ * @public + */ +export class ConflictException extends __BaseException { + readonly name: "ConflictException" = "ConflictException"; + readonly $fault: "client" = "client"; + /** + * @internal + */ + constructor(opts: __ExceptionOptionType) { + super({ + name: "ConflictException", + $fault: "client", + ...opts, + }); + Object.setPrototypeOf(this, ConflictException.prototype); + } +} + +/** + *

The specified resource ARN was not found. For troubleshooting this error, + * see ResourceNotFound in the Amazon Bedrock User Guide

+ * @public + */ +export class ResourceNotFoundException extends __BaseException { + readonly name: "ResourceNotFoundException" = "ResourceNotFoundException"; + readonly $fault: "client" = "client"; + /** + * @internal + */ + constructor(opts: __ExceptionOptionType) { + super({ + name: "ResourceNotFoundException", + $fault: "client", + ...opts, + }); + Object.setPrototypeOf(this, ResourceNotFoundException.prototype); + } +} + +/** + *

Your request exceeds the service quota for your account. You can view your quotas at Viewing service quotas. You can resubmit your request later.

+ * @public + */ +export class ServiceQuotaExceededException extends __BaseException { + readonly name: "ServiceQuotaExceededException" = "ServiceQuotaExceededException"; + readonly $fault: "client" = "client"; + /** + * @internal + */ + constructor(opts: __ExceptionOptionType) { + super({ + name: "ServiceQuotaExceededException", + $fault: "client", + ...opts, + }); + Object.setPrototypeOf(this, ServiceQuotaExceededException.prototype); + } +} + +/** + *

The service isn't currently available. For troubleshooting this error, + * see ServiceUnavailable in the Amazon Bedrock User Guide

+ * @public + */ +export class ServiceUnavailableException extends __BaseException { + readonly name: "ServiceUnavailableException" = "ServiceUnavailableException"; + readonly $fault: "server" = "server"; + /** + * @internal + */ + constructor(opts: __ExceptionOptionType) { + super({ + name: "ServiceUnavailableException", + $fault: "server", + ...opts, + }); + Object.setPrototypeOf(this, ServiceUnavailableException.prototype); + } +} + +/** + *

A tag.

+ * @public + */ +export interface Tag { + /** + *

The tag's key.

+ * @public + */ + key: string | undefined; + + /** + *

The tag's value.

+ * @public + */ + value: string | undefined; +} + +/** + * @public + */ +export interface StartAsyncInvokeRequest { + /** + *

Specify idempotency token to ensure that requests are not duplicated.

+ * @public + */ + clientRequestToken?: string | undefined; + + /** + *

The model to invoke.

+ * @public + */ + modelId: string | undefined; + + /** + *

Input to send to the model.

+ * @public + */ + modelInput: __DocumentType | undefined; + + /** + *

Where to store the output.

+ * @public + */ + outputDataConfig: AsyncInvokeOutputDataConfig | undefined; + + /** + *

Tags to apply to the invocation.

+ * @public + */ + tags?: Tag[] | undefined; +} + +/** + * @public + */ +export interface StartAsyncInvokeResponse { + /** + *

The ARN of the invocation.

+ * @public + */ + invocationArn: string | undefined; +} + /** * @public * @enum @@ -747,158 +1256,54 @@ export interface GuardrailAssessment { *

The invocation metrics for the guardrail assessment.

* @public */ - invocationMetrics?: GuardrailInvocationMetrics | undefined; -} - -/** - *

The output content produced by the guardrail.

- * @public - */ -export interface GuardrailOutputContent { - /** - *

The specific text for the output content produced by the guardrail.

- * @public - */ - text?: string | undefined; -} - -/** - * @public - */ -export interface ApplyGuardrailResponse { - /** - *

The usage details in the response from the guardrail.

- * @public - */ - usage: GuardrailUsage | undefined; - - /** - *

The action taken in the response from the guardrail.

- * @public - */ - action: GuardrailAction | undefined; - - /** - *

The output details in the response from the guardrail.

- * @public - */ - outputs: GuardrailOutputContent[] | undefined; - - /** - *

The assessment details in the response from the guardrail.

- * @public - */ - assessments: GuardrailAssessment[] | undefined; - - /** - *

The guardrail coverage details in the apply guardrail response.

- * @public - */ - guardrailCoverage?: GuardrailCoverage | undefined; -} - -/** - *

An internal server error occurred. For troubleshooting this error, - * see InternalFailure in the Amazon Bedrock User Guide

- * @public - */ -export class InternalServerException extends __BaseException { - readonly name: "InternalServerException" = "InternalServerException"; - readonly $fault: "server" = "server"; - /** - * @internal - */ - constructor(opts: __ExceptionOptionType) { - super({ - name: "InternalServerException", - $fault: "server", - ...opts, - }); - Object.setPrototypeOf(this, InternalServerException.prototype); - } + invocationMetrics?: GuardrailInvocationMetrics | undefined; } /** - *

The specified resource ARN was not found. For troubleshooting this error, - * see ResourceNotFound in the Amazon Bedrock User Guide

+ *

The output content produced by the guardrail.

* @public */ -export class ResourceNotFoundException extends __BaseException { - readonly name: "ResourceNotFoundException" = "ResourceNotFoundException"; - readonly $fault: "client" = "client"; +export interface GuardrailOutputContent { /** - * @internal + *

The specific text for the output content produced by the guardrail.

+ * @public */ - constructor(opts: __ExceptionOptionType) { - super({ - name: "ResourceNotFoundException", - $fault: "client", - ...opts, - }); - Object.setPrototypeOf(this, ResourceNotFoundException.prototype); - } + text?: string | undefined; } /** - *

Your request exceeds the service quota for your account. You can view your quotas at Viewing service quotas. You can resubmit your request later.

* @public */ -export class ServiceQuotaExceededException extends __BaseException { - readonly name: "ServiceQuotaExceededException" = "ServiceQuotaExceededException"; - readonly $fault: "client" = "client"; +export interface ApplyGuardrailResponse { /** - * @internal + *

The usage details in the response from the guardrail.

+ * @public */ - constructor(opts: __ExceptionOptionType) { - super({ - name: "ServiceQuotaExceededException", - $fault: "client", - ...opts, - }); - Object.setPrototypeOf(this, ServiceQuotaExceededException.prototype); - } -} + usage: GuardrailUsage | undefined; -/** - *

Your request was denied due to exceeding the account quotas for Amazon Bedrock. For - * troubleshooting this error, see ThrottlingException in the Amazon Bedrock User Guide

- * @public - */ -export class ThrottlingException extends __BaseException { - readonly name: "ThrottlingException" = "ThrottlingException"; - readonly $fault: "client" = "client"; /** - * @internal + *

The action taken in the response from the guardrail.

+ * @public */ - constructor(opts: __ExceptionOptionType) { - super({ - name: "ThrottlingException", - $fault: "client", - ...opts, - }); - Object.setPrototypeOf(this, ThrottlingException.prototype); - } -} + action: GuardrailAction | undefined; -/** - *

The input fails to satisfy the constraints specified by Amazon Bedrock. For troubleshooting this error, - * see ValidationError in the Amazon Bedrock User Guide

- * @public - */ -export class ValidationException extends __BaseException { - readonly name: "ValidationException" = "ValidationException"; - readonly $fault: "client" = "client"; /** - * @internal + *

The output details in the response from the guardrail.

+ * @public */ - constructor(opts: __ExceptionOptionType) { - super({ - name: "ValidationException", - $fault: "client", - ...opts, - }); - Object.setPrototypeOf(this, ValidationException.prototype); - } + outputs: GuardrailOutputContent[] | undefined; + + /** + *

The assessment details in the response from the guardrail.

+ * @public + */ + assessments: GuardrailAssessment[] | undefined; + + /** + *

The guardrail coverage details in the apply guardrail response.

+ * @public + */ + guardrailCoverage?: GuardrailCoverage | undefined; } /** @@ -1238,6 +1643,117 @@ export interface ImageBlock { source: ImageSource | undefined; } +/** + * @public + * @enum + */ +export const VideoFormat = { + FLV: "flv", + MKV: "mkv", + MOV: "mov", + MP4: "mp4", + MPEG: "mpeg", + MPG: "mpg", + THREE_GP: "three_gp", + WEBM: "webm", + WMV: "wmv", +} as const; + +/** + * @public + */ +export type VideoFormat = (typeof VideoFormat)[keyof typeof VideoFormat]; + +/** + *

A storage location in an S3 bucket.

+ * @public + */ +export interface S3Location { + /** + *

An object URI starting with s3://.

+ * @public + */ + uri: string | undefined; + + /** + *

If the bucket belongs to another AWS account, specify that account's ID.

+ * @public + */ + bucketOwner?: string | undefined; +} + +/** + *

A video source. You can upload a smaller video as a base64-encoded string as + * long as the encoded file is less than 25MB. You can also transfer videos up to 1GB in size + * from an S3 bucket.

+ * @public + */ +export type VideoSource = VideoSource.BytesMember | VideoSource.S3LocationMember | VideoSource.$UnknownMember; + +/** + * @public + */ +export namespace VideoSource { + /** + *

Video content encoded in base64.

+ * @public + */ + export interface BytesMember { + bytes: Uint8Array; + s3Location?: never; + $unknown?: never; + } + + /** + *

The location of a video object in an S3 bucket.

+ * @public + */ + export interface S3LocationMember { + bytes?: never; + s3Location: S3Location; + $unknown?: never; + } + + /** + * @public + */ + export interface $UnknownMember { + bytes?: never; + s3Location?: never; + $unknown: [string, any]; + } + + export interface Visitor { + bytes: (value: Uint8Array) => T; + s3Location: (value: S3Location) => T; + _: (name: string, value: any) => T; + } + + export const visit = (value: VideoSource, visitor: Visitor): T => { + if (value.bytes !== undefined) return visitor.bytes(value.bytes); + if (value.s3Location !== undefined) return visitor.s3Location(value.s3Location); + return visitor._(value.$unknown[0], value.$unknown[1]); + }; +} + +/** + *

A video block.

+ * @public + */ +export interface VideoBlock { + /** + *

The block's format.

+ * @public + */ + format: VideoFormat | undefined; + + /** + *

The block's source.

+ * @public + */ + source: VideoSource | undefined; +} + /** *

The tool result content block.

* @public @@ -1247,6 +1763,7 @@ export type ToolResultContentBlock = | ToolResultContentBlock.ImageMember | ToolResultContentBlock.JsonMember | ToolResultContentBlock.TextMember + | ToolResultContentBlock.VideoMember | ToolResultContentBlock.$UnknownMember; /** @@ -1262,6 +1779,7 @@ export namespace ToolResultContentBlock { text?: never; image?: never; document?: never; + video?: never; $unknown?: never; } @@ -1274,6 +1792,7 @@ export namespace ToolResultContentBlock { text: string; image?: never; document?: never; + video?: never; $unknown?: never; } @@ -1289,6 +1808,7 @@ export namespace ToolResultContentBlock { text?: never; image: ImageBlock; document?: never; + video?: never; $unknown?: never; } @@ -1301,6 +1821,20 @@ export namespace ToolResultContentBlock { text?: never; image?: never; document: DocumentBlock; + video?: never; + $unknown?: never; + } + + /** + *

A tool result that is video.

+ * @public + */ + export interface VideoMember { + json?: never; + text?: never; + image?: never; + document?: never; + video: VideoBlock; $unknown?: never; } @@ -1312,6 +1846,7 @@ export namespace ToolResultContentBlock { text?: never; image?: never; document?: never; + video?: never; $unknown: [string, any]; } @@ -1320,6 +1855,7 @@ export namespace ToolResultContentBlock { text: (value: string) => T; image: (value: ImageBlock) => T; document: (value: DocumentBlock) => T; + video: (value: VideoBlock) => T; _: (name: string, value: any) => T; } @@ -1328,6 +1864,7 @@ export namespace ToolResultContentBlock { if (value.text !== undefined) return visitor.text(value.text); if (value.image !== undefined) return visitor.image(value.image); if (value.document !== undefined) return visitor.document(value.document); + if (value.video !== undefined) return visitor.video(value.video); return visitor._(value.$unknown[0], value.$unknown[1]); }; } @@ -1410,6 +1947,7 @@ export type ContentBlock = | ContentBlock.TextMember | ContentBlock.ToolResultMember | ContentBlock.ToolUseMember + | ContentBlock.VideoMember | ContentBlock.$UnknownMember; /** @@ -1424,6 +1962,7 @@ export namespace ContentBlock { text: string; image?: never; document?: never; + video?: never; toolUse?: never; toolResult?: never; guardContent?: never; @@ -1441,6 +1980,7 @@ export namespace ContentBlock { text?: never; image: ImageBlock; document?: never; + video?: never; toolUse?: never; toolResult?: never; guardContent?: never; @@ -1455,6 +1995,22 @@ export namespace ContentBlock { text?: never; image?: never; document: DocumentBlock; + video?: never; + toolUse?: never; + toolResult?: never; + guardContent?: never; + $unknown?: never; + } + + /** + *

Video to include in the message.

+ * @public + */ + export interface VideoMember { + text?: never; + image?: never; + document?: never; + video: VideoBlock; toolUse?: never; toolResult?: never; guardContent?: never; @@ -1469,6 +2025,7 @@ export namespace ContentBlock { text?: never; image?: never; document?: never; + video?: never; toolUse: ToolUseBlock; toolResult?: never; guardContent?: never; @@ -1483,6 +2040,7 @@ export namespace ContentBlock { text?: never; image?: never; document?: never; + video?: never; toolUse?: never; toolResult: ToolResultBlock; guardContent?: never; @@ -1502,6 +2060,7 @@ export namespace ContentBlock { text?: never; image?: never; document?: never; + video?: never; toolUse?: never; toolResult?: never; guardContent: GuardrailConverseContentBlock; @@ -1515,6 +2074,7 @@ export namespace ContentBlock { text?: never; image?: never; document?: never; + video?: never; toolUse?: never; toolResult?: never; guardContent?: never; @@ -1525,6 +2085,7 @@ export namespace ContentBlock { text: (value: string) => T; image: (value: ImageBlock) => T; document: (value: DocumentBlock) => T; + video: (value: VideoBlock) => T; toolUse: (value: ToolUseBlock) => T; toolResult: (value: ToolResultBlock) => T; guardContent: (value: GuardrailConverseContentBlock) => T; @@ -1535,6 +2096,7 @@ export namespace ContentBlock { if (value.text !== undefined) return visitor.text(value.text); if (value.image !== undefined) return visitor.image(value.image); if (value.document !== undefined) return visitor.document(value.document); + if (value.video !== undefined) return visitor.video(value.video); if (value.toolUse !== undefined) return visitor.toolUse(value.toolUse); if (value.toolResult !== undefined) return visitor.toolResult(value.toolResult); if (value.guardContent !== undefined) return visitor.guardContent(value.guardContent); @@ -1913,9 +2475,6 @@ export namespace Tool { /** *

Configuration information for the tools that you pass to a model. For more information, see Tool use (function calling) in the Amazon Bedrock User Guide.

- * - *

This field is only supported by Anthropic Claude 3, Cohere Command R, Cohere Command R+, and Mistral Large models.

- *
* @public */ export interface ToolConfiguration { @@ -1982,9 +2541,8 @@ export interface ConverseRequest { /** *

Configuration information for the tools that the model can use when generating a response.

- * - *

This field is only supported by Anthropic Claude 3, Cohere Command R, Cohere Command R+, and Mistral Large models.

- *
+ *

For information about models that support tool use, see + * Supported models and model features.

* @public */ toolConfig?: ToolConfiguration | undefined; @@ -2028,6 +2586,12 @@ export interface ConverseRequest { */ additionalModelResponseFieldPaths?: string[] | undefined; + /** + *

Key-value pairs that you can use to filter invocation logs.

+ * @public + */ + requestMetadata?: Record | undefined; + /** *

Model performance settings for the request.

* @public @@ -2290,27 +2854,6 @@ export class ModelTimeoutException extends __BaseException { } } -/** - *

The service isn't currently available. For troubleshooting this error, - * see ServiceUnavailable in the Amazon Bedrock User Guide

- * @public - */ -export class ServiceUnavailableException extends __BaseException { - readonly name: "ServiceUnavailableException" = "ServiceUnavailableException"; - readonly $fault: "server" = "server"; - /** - * @internal - */ - constructor(opts: __ExceptionOptionType) { - super({ - name: "ServiceUnavailableException", - $fault: "server", - ...opts, - }); - Object.setPrototypeOf(this, ServiceUnavailableException.prototype); - } -} - /** * @public * @enum @@ -2409,9 +2952,8 @@ export interface ConverseStreamRequest { /** *

Configuration information for the tools that the model can use when generating a response.

- * - *

This field is only supported by Anthropic Claude 3 models.

- *
+ *

For information about models that support streaming tool use, see + * Supported models and model features.

* @public */ toolConfig?: ToolConfiguration | undefined; @@ -2455,6 +2997,12 @@ export interface ConverseStreamRequest { */ additionalModelResponseFieldPaths?: string[] | undefined; + /** + *

Key-value pairs that you can use to filter invocation logs.

+ * @public + */ + requestMetadata?: Record | undefined; + /** *

Model performance settings for the request.

* @public @@ -2926,7 +3474,8 @@ export namespace ConverseStreamOutput { } /** - *

Input validation failed. Check your request parameters and retry the request.

+ *

The input fails to satisfy the constraints specified by Amazon Bedrock. For troubleshooting this error, + * see ValidationError in the Amazon Bedrock User Guide

* @public */ export interface ValidationExceptionMember { @@ -2945,7 +3494,8 @@ export namespace ConverseStreamOutput { } /** - *

The number of requests exceeds the limit. Resubmit your request later.

+ *

Your request was denied due to exceeding the account quotas for Amazon Bedrock. For + * troubleshooting this error, see ThrottlingException in the Amazon Bedrock User Guide

* @public */ export interface ThrottlingExceptionMember { @@ -3452,6 +4002,43 @@ export interface InvokeModelWithResponseStreamResponse { performanceConfigLatency?: PerformanceConfigLatency | undefined; } +/** + * @internal + */ +export const GetAsyncInvokeResponseFilterSensitiveLog = (obj: GetAsyncInvokeResponse): any => ({ + ...obj, + ...(obj.failureMessage && { failureMessage: SENSITIVE_STRING }), + ...(obj.outputDataConfig && { outputDataConfig: obj.outputDataConfig }), +}); + +/** + * @internal + */ +export const AsyncInvokeSummaryFilterSensitiveLog = (obj: AsyncInvokeSummary): any => ({ + ...obj, + ...(obj.failureMessage && { failureMessage: SENSITIVE_STRING }), + ...(obj.outputDataConfig && { outputDataConfig: obj.outputDataConfig }), +}); + +/** + * @internal + */ +export const ListAsyncInvokesResponseFilterSensitiveLog = (obj: ListAsyncInvokesResponse): any => ({ + ...obj, + ...(obj.asyncInvokeSummaries && { + asyncInvokeSummaries: obj.asyncInvokeSummaries.map((item) => AsyncInvokeSummaryFilterSensitiveLog(item)), + }), +}); + +/** + * @internal + */ +export const StartAsyncInvokeRequestFilterSensitiveLog = (obj: StartAsyncInvokeRequest): any => ({ + ...obj, + ...(obj.modelInput && { modelInput: SENSITIVE_STRING }), + ...(obj.outputDataConfig && { outputDataConfig: obj.outputDataConfig }), +}); + /** * @internal */ @@ -3461,6 +4048,7 @@ export const ConverseRequestFilterSensitiveLog = (obj: ConverseRequest): any => ...(obj.system && { system: obj.system.map((item) => item) }), ...(obj.toolConfig && { toolConfig: obj.toolConfig }), ...(obj.promptVariables && { promptVariables: SENSITIVE_STRING }), + ...(obj.requestMetadata && { requestMetadata: SENSITIVE_STRING }), }); /** @@ -3472,6 +4060,7 @@ export const ConverseStreamRequestFilterSensitiveLog = (obj: ConverseStreamReque ...(obj.system && { system: obj.system.map((item) => item) }), ...(obj.toolConfig && { toolConfig: obj.toolConfig }), ...(obj.promptVariables && { promptVariables: SENSITIVE_STRING }), + ...(obj.requestMetadata && { requestMetadata: SENSITIVE_STRING }), }); /** diff --git a/clients/client-bedrock-runtime/src/pagination/Interfaces.ts b/clients/client-bedrock-runtime/src/pagination/Interfaces.ts new file mode 100644 index 000000000000..441261d4dd66 --- /dev/null +++ b/clients/client-bedrock-runtime/src/pagination/Interfaces.ts @@ -0,0 +1,11 @@ +// smithy-typescript generated code +import { PaginationConfiguration } from "@smithy/types"; + +import { BedrockRuntimeClient } from "../BedrockRuntimeClient"; + +/** + * @public + */ +export interface BedrockRuntimePaginationConfiguration extends PaginationConfiguration { + client: BedrockRuntimeClient; +} diff --git a/clients/client-bedrock-runtime/src/pagination/ListAsyncInvokesPaginator.ts b/clients/client-bedrock-runtime/src/pagination/ListAsyncInvokesPaginator.ts new file mode 100644 index 000000000000..7e6f6f7174d2 --- /dev/null +++ b/clients/client-bedrock-runtime/src/pagination/ListAsyncInvokesPaginator.ts @@ -0,0 +1,24 @@ +// smithy-typescript generated code +import { createPaginator } from "@smithy/core"; +import { Paginator } from "@smithy/types"; + +import { BedrockRuntimeClient } from "../BedrockRuntimeClient"; +import { + ListAsyncInvokesCommand, + ListAsyncInvokesCommandInput, + ListAsyncInvokesCommandOutput, +} from "../commands/ListAsyncInvokesCommand"; +import { BedrockRuntimePaginationConfiguration } from "./Interfaces"; + +/** + * @public + */ +export const paginateListAsyncInvokes: ( + config: BedrockRuntimePaginationConfiguration, + input: ListAsyncInvokesCommandInput, + ...rest: any[] +) => Paginator = createPaginator< + BedrockRuntimePaginationConfiguration, + ListAsyncInvokesCommandInput, + ListAsyncInvokesCommandOutput +>(BedrockRuntimeClient, ListAsyncInvokesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-bedrock-runtime/src/pagination/index.ts b/clients/client-bedrock-runtime/src/pagination/index.ts new file mode 100644 index 000000000000..6bcb826fb7d7 --- /dev/null +++ b/clients/client-bedrock-runtime/src/pagination/index.ts @@ -0,0 +1,3 @@ +// smithy-typescript generated code +export * from "./Interfaces"; +export * from "./ListAsyncInvokesPaginator"; diff --git a/clients/client-bedrock-runtime/src/protocols/Aws_restJson1.ts b/clients/client-bedrock-runtime/src/protocols/Aws_restJson1.ts index 8915b346b9ca..fd0303c985e6 100644 --- a/clients/client-bedrock-runtime/src/protocols/Aws_restJson1.ts +++ b/clients/client-bedrock-runtime/src/protocols/Aws_restJson1.ts @@ -15,10 +15,13 @@ import { expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, + extendedEncodeURIComponent as __extendedEncodeURIComponent, isSerializableHeaderValue, limitedParseDouble as __limitedParseDouble, map, + parseRfc3339DateTimeWithOffset as __parseRfc3339DateTimeWithOffset, resolvedPath as __resolvedPath, + serializeDateTime as __serializeDateTime, serializeFloat as __serializeFloat, take, withBaseException, @@ -30,20 +33,28 @@ import { ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, } from "@smithy/types"; +import { v4 as generateIdempotencyToken } from "uuid"; import { ApplyGuardrailCommandInput, ApplyGuardrailCommandOutput } from "../commands/ApplyGuardrailCommand"; import { ConverseCommandInput, ConverseCommandOutput } from "../commands/ConverseCommand"; import { ConverseStreamCommandInput, ConverseStreamCommandOutput } from "../commands/ConverseStreamCommand"; +import { GetAsyncInvokeCommandInput, GetAsyncInvokeCommandOutput } from "../commands/GetAsyncInvokeCommand"; import { InvokeModelCommandInput, InvokeModelCommandOutput } from "../commands/InvokeModelCommand"; import { InvokeModelWithResponseStreamCommandInput, InvokeModelWithResponseStreamCommandOutput, } from "../commands/InvokeModelWithResponseStreamCommand"; +import { ListAsyncInvokesCommandInput, ListAsyncInvokesCommandOutput } from "../commands/ListAsyncInvokesCommand"; +import { StartAsyncInvokeCommandInput, StartAsyncInvokeCommandOutput } from "../commands/StartAsyncInvokeCommand"; import { BedrockRuntimeServiceException as __BaseException } from "../models/BedrockRuntimeServiceException"; import { AccessDeniedException, AnyToolChoice, + AsyncInvokeOutputDataConfig, + AsyncInvokeS3OutputDataConfig, + AsyncInvokeSummary, AutoToolChoice, + ConflictException, ContentBlock, ContentBlockDeltaEvent, ContentBlockStartEvent, @@ -83,10 +94,12 @@ import { PromptVariableValues, ResourceNotFoundException, ResponseStream, + S3Location, ServiceQuotaExceededException, ServiceUnavailableException, SpecificToolChoice, SystemContentBlock, + Tag, ThrottlingException, Tool, ToolChoice, @@ -97,6 +110,8 @@ import { ToolSpecification, ToolUseBlock, ValidationException, + VideoBlock, + VideoSource, } from "../models/models_0"; /** @@ -147,6 +162,7 @@ export const se_ConverseCommand = async ( messages: (_) => se_Messages(_, context), performanceConfig: (_) => _json(_), promptVariables: (_) => _json(_), + requestMetadata: (_) => _json(_), system: (_) => _json(_), toolConfig: (_) => se_ToolConfiguration(_, context), }) @@ -178,6 +194,7 @@ export const se_ConverseStreamCommand = async ( messages: (_) => se_Messages(_, context), performanceConfig: (_) => _json(_), promptVariables: (_) => _json(_), + requestMetadata: (_) => _json(_), system: (_) => _json(_), toolConfig: (_) => se_ToolConfiguration(_, context), }) @@ -186,6 +203,22 @@ export const se_ConverseStreamCommand = async ( return b.build(); }; +/** + * serializeAws_restJson1GetAsyncInvokeCommand + */ +export const se_GetAsyncInvokeCommand = async ( + input: GetAsyncInvokeCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const b = rb(input, context); + const headers: any = {}; + b.bp("/async-invoke/{invocationArn}"); + b.p("invocationArn", () => input.invocationArn!, "{invocationArn}", false); + let body: any; + b.m("GET").h(headers).b(body); + return b.build(); +}; + /** * serializeAws_restJson1InvokeModelCommand */ @@ -238,6 +271,56 @@ export const se_InvokeModelWithResponseStreamCommand = async ( return b.build(); }; +/** + * serializeAws_restJson1ListAsyncInvokesCommand + */ +export const se_ListAsyncInvokesCommand = async ( + input: ListAsyncInvokesCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const b = rb(input, context); + const headers: any = {}; + b.bp("/async-invoke"); + const query: any = map({ + [_sTA]: [() => input.submitTimeAfter !== void 0, () => __serializeDateTime(input[_sTA]!).toString()], + [_sTB]: [() => input.submitTimeBefore !== void 0, () => __serializeDateTime(input[_sTB]!).toString()], + [_sE]: [, input[_sE]!], + [_mR]: [() => input.maxResults !== void 0, () => input[_mR]!.toString()], + [_nT]: [, input[_nT]!], + [_sB]: [, input[_sB]!], + [_sO]: [, input[_sO]!], + }); + let body: any; + b.m("GET").h(headers).q(query).b(body); + return b.build(); +}; + +/** + * serializeAws_restJson1StartAsyncInvokeCommand + */ +export const se_StartAsyncInvokeCommand = async ( + input: StartAsyncInvokeCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const b = rb(input, context); + const headers: any = { + "content-type": "application/json", + }; + b.bp("/async-invoke"); + let body: any; + body = JSON.stringify( + take(input, { + clientRequestToken: [true, (_) => _ ?? generateIdempotencyToken()], + modelId: [], + modelInput: (_) => se_ModelInputPayload(_, context), + outputDataConfig: (_) => _json(_), + tags: (_) => _json(_), + }) + ); + b.m("POST").h(headers).b(body); + return b.build(); +}; + /** * deserializeAws_restJson1ApplyGuardrailCommand */ @@ -308,6 +391,35 @@ export const de_ConverseStreamCommand = async ( return contents; }; +/** + * deserializeAws_restJson1GetAsyncInvokeCommand + */ +export const de_GetAsyncInvokeCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return de_CommandError(output, context); + } + const contents: any = map({ + $metadata: deserializeMetadata(output), + }); + const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + const doc = take(data, { + clientRequestToken: __expectString, + endTime: (_) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)), + failureMessage: __expectString, + invocationArn: __expectString, + lastModifiedTime: (_) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)), + modelArn: __expectString, + outputDataConfig: (_) => _json(__expectUnion(_)), + status: __expectString, + submitTime: (_) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)), + }); + Object.assign(contents, doc); + return contents; +}; + /** * deserializeAws_restJson1InvokeModelCommand */ @@ -348,6 +460,49 @@ export const de_InvokeModelWithResponseStreamCommand = async ( return contents; }; +/** + * deserializeAws_restJson1ListAsyncInvokesCommand + */ +export const de_ListAsyncInvokesCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return de_CommandError(output, context); + } + const contents: any = map({ + $metadata: deserializeMetadata(output), + }); + const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + const doc = take(data, { + asyncInvokeSummaries: (_) => de_AsyncInvokeSummaries(_, context), + nextToken: __expectString, + }); + Object.assign(contents, doc); + return contents; +}; + +/** + * deserializeAws_restJson1StartAsyncInvokeCommand + */ +export const de_StartAsyncInvokeCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return de_CommandError(output, context); + } + const contents: any = map({ + $metadata: deserializeMetadata(output), + }); + const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + const doc = take(data, { + invocationArn: __expectString, + }); + Object.assign(contents, doc); + return contents; +}; + /** * deserialize_Aws_restJson1CommandError */ @@ -391,6 +546,9 @@ const de_CommandError = async (output: __HttpResponse, context: __SerdeContext): case "ModelStreamErrorException": case "com.amazonaws.bedrockruntime#ModelStreamErrorException": throw await de_ModelStreamErrorExceptionRes(parsedOutput, context); + case "ConflictException": + case "com.amazonaws.bedrockruntime#ConflictException": + throw await de_ConflictExceptionRes(parsedOutput, context); default: const parsedBody = parsedOutput.body; return throwDefaultError({ @@ -422,6 +580,23 @@ const de_AccessDeniedExceptionRes = async ( return __decorateServiceException(exception, parsedOutput.body); }; +/** + * deserializeAws_restJson1ConflictExceptionRes + */ +const de_ConflictExceptionRes = async (parsedOutput: any, context: __SerdeContext): Promise => { + const contents: any = map({}); + const data: any = parsedOutput.body; + const doc = take(data, { + message: __expectString, + }); + Object.assign(contents, doc); + const exception = new ConflictException({ + $metadata: deserializeMetadata(parsedOutput), + ...contents, + }); + return __decorateServiceException(exception, parsedOutput.body); +}; + /** * deserializeAws_restJson1InternalServerExceptionRes */ @@ -847,6 +1022,10 @@ const de_ValidationException_event = async (output: any, context: __SerdeContext // se_AnyToolChoice omitted. +// se_AsyncInvokeOutputDataConfig omitted. + +// se_AsyncInvokeS3OutputDataConfig omitted. + // se_AutoToolChoice omitted. /** @@ -860,6 +1039,7 @@ const se_ContentBlock = (input: ContentBlock, context: __SerdeContext): any => { text: (value) => ({ text: value }), toolResult: (value) => ({ toolResult: se_ToolResultBlock(value, context) }), toolUse: (value) => ({ toolUse: se_ToolUseBlock(value, context) }), + video: (value) => ({ video: se_VideoBlock(value, context) }), _: (name, value) => ({ name: value } as any), }); }; @@ -967,6 +1147,13 @@ const se_Messages = (input: Message[], context: __SerdeContext): any => { }); }; +/** + * serializeAws_restJson1ModelInputPayload + */ +const se_ModelInputPayload = (input: __DocumentType, context: __SerdeContext): any => { + return input; +}; + // se_NonEmptyStringList omitted. // se_PerformanceConfiguration omitted. @@ -975,12 +1162,20 @@ const se_Messages = (input: Message[], context: __SerdeContext): any => { // se_PromptVariableValues omitted. +// se_RequestMetadata omitted. + +// se_S3Location omitted. + // se_SpecificToolChoice omitted. // se_SystemContentBlock omitted. // se_SystemContentBlocks omitted. +// se_Tag omitted. + +// se_TagList omitted. + /** * serializeAws_restJson1Tool */ @@ -1033,6 +1228,7 @@ const se_ToolResultContentBlock = (input: ToolResultContentBlock, context: __Ser image: (value) => ({ image: se_ImageBlock(value, context) }), json: (value) => ({ json: se_Document(value, context) }), text: (value) => ({ text: value }), + video: (value) => ({ video: se_VideoBlock(value, context) }), _: (name, value) => ({ name: value } as any), }); }; @@ -1081,6 +1277,27 @@ const se_ToolUseBlock = (input: ToolUseBlock, context: __SerdeContext): any => { }); }; +/** + * serializeAws_restJson1VideoBlock + */ +const se_VideoBlock = (input: VideoBlock, context: __SerdeContext): any => { + return take(input, { + format: [], + source: (_) => se_VideoSource(_, context), + }); +}; + +/** + * serializeAws_restJson1VideoSource + */ +const se_VideoSource = (input: VideoSource, context: __SerdeContext): any => { + return VideoSource.visit(input, { + bytes: (value) => ({ bytes: context.base64Encoder(value) }), + s3Location: (value) => ({ s3Location: _json(value) }), + _: (name, value) => ({ name: value } as any), + }); +}; + /** * serializeAws_restJson1Document */ @@ -1088,6 +1305,39 @@ const se_Document = (input: __DocumentType, context: __SerdeContext): any => { return input; }; +// de_AsyncInvokeOutputDataConfig omitted. + +// de_AsyncInvokeS3OutputDataConfig omitted. + +/** + * deserializeAws_restJson1AsyncInvokeSummaries + */ +const de_AsyncInvokeSummaries = (output: any, context: __SerdeContext): AsyncInvokeSummary[] => { + const retVal = (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + return de_AsyncInvokeSummary(entry, context); + }); + return retVal; +}; + +/** + * deserializeAws_restJson1AsyncInvokeSummary + */ +const de_AsyncInvokeSummary = (output: any, context: __SerdeContext): AsyncInvokeSummary => { + return take(output, { + clientRequestToken: __expectString, + endTime: (_: any) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)), + failureMessage: __expectString, + invocationArn: __expectString, + lastModifiedTime: (_: any) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)), + modelArn: __expectString, + outputDataConfig: (_: any) => _json(__expectUnion(_)), + status: __expectString, + submitTime: (_: any) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)), + }) as any; +}; + /** * deserializeAws_restJson1ContentBlock */ @@ -1120,6 +1370,11 @@ const de_ContentBlock = (output: any, context: __SerdeContext): ContentBlock => toolUse: de_ToolUseBlock(output.toolUse, context), }; } + if (output.video != null) { + return { + video: de_VideoBlock(output.video, context), + }; + } return { $unknown: Object.entries(output)[0] }; }; @@ -1426,6 +1681,8 @@ const de_PayloadPart = (output: any, context: __SerdeContext): PayloadPart => { // de_PerformanceConfiguration omitted. +// de_S3Location omitted. + // de_TokenUsage omitted. /** @@ -1461,6 +1718,11 @@ const de_ToolResultContentBlock = (output: any, context: __SerdeContext): ToolRe if (__expectString(output.text) !== undefined) { return { text: __expectString(output.text) as any }; } + if (output.video != null) { + return { + video: de_VideoBlock(output.video, context), + }; + } return { $unknown: Object.entries(output)[0] }; }; @@ -1491,6 +1753,33 @@ const de_ToolUseBlock = (output: any, context: __SerdeContext): ToolUseBlock => // de_ToolUseBlockStart omitted. +/** + * deserializeAws_restJson1VideoBlock + */ +const de_VideoBlock = (output: any, context: __SerdeContext): VideoBlock => { + return take(output, { + format: __expectString, + source: (_: any) => de_VideoSource(__expectUnion(_), context), + }) as any; +}; + +/** + * deserializeAws_restJson1VideoSource + */ +const de_VideoSource = (output: any, context: __SerdeContext): VideoSource => { + if (output.bytes != null) { + return { + bytes: context.base64Decoder(output.bytes), + }; + } + if (output.s3Location != null) { + return { + s3Location: _json(output.s3Location), + }; + } + return { $unknown: Object.entries(output)[0] }; +}; + /** * deserializeAws_restJson1Document */ @@ -1515,7 +1804,14 @@ const _cT = "contentType"; const _ct = "content-type"; const _gI = "guardrailIdentifier"; const _gV = "guardrailVersion"; +const _mR = "maxResults"; +const _nT = "nextToken"; const _pCL = "performanceConfigLatency"; +const _sB = "sortBy"; +const _sE = "statusEquals"; +const _sO = "sortOrder"; +const _sTA = "submitTimeAfter"; +const _sTB = "submitTimeBefore"; const _t = "trace"; const _xaba = "x-amzn-bedrock-accept"; const _xabct = "x-amzn-bedrock-content-type"; diff --git a/codegen/sdk-codegen/aws-models/bedrock-runtime.json b/codegen/sdk-codegen/aws-models/bedrock-runtime.json index f95459ecff10..7730c11bf960 100644 --- a/codegen/sdk-codegen/aws-models/bedrock-runtime.json +++ b/codegen/sdk-codegen/aws-models/bedrock-runtime.json @@ -14,6 +14,12 @@ "smithy.api#httpError": 403 } }, + "com.amazonaws.bedrockruntime#AccountId": { + "type": "string", + "traits": { + "smithy.api#pattern": "^[0-9]{12}$" + } + }, "com.amazonaws.bedrockruntime#AdditionalModelResponseFieldPaths": { "type": "list", "member": { @@ -35,6 +41,9 @@ "type": "service", "version": "2023-09-30", "resources": [ + { + "target": "com.amazonaws.bedrockruntime#AsyncInvokeResource" + }, { "target": "com.amazonaws.bedrockruntime#GuardrailResource" }, @@ -756,7 +765,7 @@ } ], "traits": { - "smithy.api#documentation": "

The action to apply a guardrail.

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

The action to apply a guardrail.

\n

For troubleshooting some of the common errors you might encounter when using the ApplyGuardrail API, \n see Troubleshooting Amazon Bedrock API Error Codes in the Amazon Bedrock User Guide

", "smithy.api#http": { "code": 200, "method": "POST", @@ -844,6 +853,195 @@ "smithy.api#output": {} } }, + "com.amazonaws.bedrockruntime#AsyncInvokeArn": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 2048 + }, + "smithy.api#pattern": "^arn:[a-z0-9\\-]+:bedrock:[a-z0-9\\-]*:[0-9]*:(provisioned-model|foundation-model)/.+$" + } + }, + "com.amazonaws.bedrockruntime#AsyncInvokeIdempotencyToken": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 256 + }, + "smithy.api#pattern": "^[!-~]*$" + } + }, + "com.amazonaws.bedrockruntime#AsyncInvokeIdentifier": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 256 + }, + "smithy.api#pattern": "^[a-zA-Z_\\.\\-/0-9:]+$" + } + }, + "com.amazonaws.bedrockruntime#AsyncInvokeMessage": { + "type": "string", + "traits": { + "smithy.api#length": { + "max": 2048 + }, + "smithy.api#sensitive": {} + } + }, + "com.amazonaws.bedrockruntime#AsyncInvokeOutputDataConfig": { + "type": "union", + "members": { + "s3OutputDataConfig": { + "target": "com.amazonaws.bedrockruntime#AsyncInvokeS3OutputDataConfig", + "traits": { + "smithy.api#documentation": "

A storage location for the output data in an S3 bucket

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Asynchronous invocation output data settings.

" + } + }, + "com.amazonaws.bedrockruntime#AsyncInvokeResource": { + "type": "resource", + "operations": [ + { + "target": "com.amazonaws.bedrockruntime#GetAsyncInvoke" + }, + { + "target": "com.amazonaws.bedrockruntime#ListAsyncInvokes" + }, + { + "target": "com.amazonaws.bedrockruntime#StartAsyncInvoke" + } + ] + }, + "com.amazonaws.bedrockruntime#AsyncInvokeS3OutputDataConfig": { + "type": "structure", + "members": { + "s3Uri": { + "target": "com.amazonaws.bedrockruntime#S3Uri", + "traits": { + "smithy.api#documentation": "

An object URI starting with s3://.

", + "smithy.api#required": {} + } + }, + "kmsKeyId": { + "target": "com.amazonaws.bedrockruntime#KmsKeyId", + "traits": { + "smithy.api#documentation": "

A KMS encryption key ID.

" + } + }, + "bucketOwner": { + "target": "com.amazonaws.bedrockruntime#AccountId", + "traits": { + "smithy.api#documentation": "

If the bucket belongs to another AWS account, specify that account's ID.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Asynchronous invocation output data settings.

" + } + }, + "com.amazonaws.bedrockruntime#AsyncInvokeStatus": { + "type": "enum", + "members": { + "IN_PROGRESS": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "InProgress" + } + }, + "COMPLETED": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "Completed" + } + }, + "FAILED": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "Failed" + } + } + } + }, + "com.amazonaws.bedrockruntime#AsyncInvokeSummaries": { + "type": "list", + "member": { + "target": "com.amazonaws.bedrockruntime#AsyncInvokeSummary" + } + }, + "com.amazonaws.bedrockruntime#AsyncInvokeSummary": { + "type": "structure", + "members": { + "invocationArn": { + "target": "com.amazonaws.bedrockruntime#InvocationArn", + "traits": { + "smithy.api#documentation": "

The invocation's ARN.

", + "smithy.api#required": {} + } + }, + "modelArn": { + "target": "com.amazonaws.bedrockruntime#AsyncInvokeArn", + "traits": { + "smithy.api#documentation": "

The invoked model's ARN.

", + "smithy.api#required": {} + } + }, + "clientRequestToken": { + "target": "com.amazonaws.bedrockruntime#AsyncInvokeIdempotencyToken", + "traits": { + "smithy.api#documentation": "

The invocation's idempotency token.

" + } + }, + "status": { + "target": "com.amazonaws.bedrockruntime#AsyncInvokeStatus", + "traits": { + "smithy.api#documentation": "

The invocation's status.

" + } + }, + "failureMessage": { + "target": "com.amazonaws.bedrockruntime#AsyncInvokeMessage", + "traits": { + "smithy.api#documentation": "

An error message.

" + } + }, + "submitTime": { + "target": "com.amazonaws.bedrockruntime#Timestamp", + "traits": { + "smithy.api#documentation": "

When the invocation was submitted.

", + "smithy.api#required": {} + } + }, + "lastModifiedTime": { + "target": "com.amazonaws.bedrockruntime#Timestamp", + "traits": { + "smithy.api#documentation": "

When the invocation was last modified.

" + } + }, + "endTime": { + "target": "com.amazonaws.bedrockruntime#Timestamp", + "traits": { + "smithy.api#documentation": "

When the invocation ended.

" + } + }, + "outputDataConfig": { + "target": "com.amazonaws.bedrockruntime#AsyncInvokeOutputDataConfig", + "traits": { + "smithy.api#documentation": "

The invocation's output data settings.

", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#documentation": "

A summary of an asynchronous invocation.

" + } + }, "com.amazonaws.bedrockruntime#AutoToolChoice": { "type": "structure", "members": {}, @@ -860,6 +1058,19 @@ "smithy.api#sensitive": {} } }, + "com.amazonaws.bedrockruntime#ConflictException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.bedrockruntime#NonBlankString" + } + }, + "traits": { + "smithy.api#documentation": "

Error occurred because of a conflict while performing an operation.

", + "smithy.api#error": "client", + "smithy.api#httpError": 400 + } + }, "com.amazonaws.bedrockruntime#ContentBlock": { "type": "union", "members": { @@ -881,6 +1092,12 @@ "smithy.api#documentation": "

A document to include in the message.

" } }, + "video": { + "target": "com.amazonaws.bedrockruntime#VideoBlock", + "traits": { + "smithy.api#documentation": "

Video to include in the message.

" + } + }, "toolUse": { "target": "com.amazonaws.bedrockruntime#ToolUseBlock", "traits": { @@ -1137,7 +1354,7 @@ "toolConfig": { "target": "com.amazonaws.bedrockruntime#ToolConfiguration", "traits": { - "smithy.api#documentation": "

Configuration information for the tools that the model can use when generating a response.

\n \n

This field is only supported by Anthropic Claude 3, Cohere Command R, Cohere Command R+, and Mistral Large models.

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

Configuration information for the tools that the model can use when generating a response.

\n

For information about models that support tool use, see \n Supported models and model features.

" } }, "guardrailConfig": { @@ -1167,6 +1384,12 @@ } } }, + "requestMetadata": { + "target": "com.amazonaws.bedrockruntime#RequestMetadata", + "traits": { + "smithy.api#documentation": "

Key-value pairs that you can use to filter invocation logs.

" + } + }, "performanceConfig": { "target": "com.amazonaws.bedrockruntime#PerformanceConfiguration", "traits": { @@ -1381,13 +1604,13 @@ "validationException": { "target": "com.amazonaws.bedrockruntime#ValidationException", "traits": { - "smithy.api#documentation": "

Input validation failed. Check your request parameters and retry the request.

" + "smithy.api#documentation": "

The input fails to satisfy the constraints specified by Amazon Bedrock. For troubleshooting this error, \n see ValidationError in the Amazon Bedrock User Guide

" } }, "throttlingException": { "target": "com.amazonaws.bedrockruntime#ThrottlingException", "traits": { - "smithy.api#documentation": "

The number of requests exceeds the limit. Resubmit your request later.

" + "smithy.api#documentation": "

Your request was denied due to exceeding the account quotas for Amazon Bedrock. For\n troubleshooting this error, see ThrottlingException in the Amazon Bedrock User Guide

" } }, "serviceUnavailableException": { @@ -1434,7 +1657,7 @@ "toolConfig": { "target": "com.amazonaws.bedrockruntime#ToolConfiguration", "traits": { - "smithy.api#documentation": "

Configuration information for the tools that the model can use when generating a response.

\n \n

This field is only supported by Anthropic Claude 3 models.

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

Configuration information for the tools that the model can use when generating a response.

\n

For information about models that support streaming tool use, see \n Supported models and model features.

" } }, "guardrailConfig": { @@ -1464,6 +1687,12 @@ } } }, + "requestMetadata": { + "target": "com.amazonaws.bedrockruntime#RequestMetadata", + "traits": { + "smithy.api#documentation": "

Key-value pairs that you can use to filter invocation logs.

" + } + }, "performanceConfig": { "target": "com.amazonaws.bedrockruntime#PerformanceConfiguration", "traits": { @@ -1627,6 +1856,121 @@ "smithy.api#documentation": "

Contains the content of a document.

" } }, + "com.amazonaws.bedrockruntime#GetAsyncInvoke": { + "type": "operation", + "input": { + "target": "com.amazonaws.bedrockruntime#GetAsyncInvokeRequest" + }, + "output": { + "target": "com.amazonaws.bedrockruntime#GetAsyncInvokeResponse" + }, + "errors": [ + { + "target": "com.amazonaws.bedrockruntime#AccessDeniedException" + }, + { + "target": "com.amazonaws.bedrockruntime#InternalServerException" + }, + { + "target": "com.amazonaws.bedrockruntime#ThrottlingException" + }, + { + "target": "com.amazonaws.bedrockruntime#ValidationException" + } + ], + "traits": { + "smithy.api#documentation": "

Retrieve information about an asynchronous invocation.

", + "smithy.api#http": { + "code": 200, + "method": "GET", + "uri": "/async-invoke/{invocationArn}" + }, + "smithy.api#readonly": {} + } + }, + "com.amazonaws.bedrockruntime#GetAsyncInvokeRequest": { + "type": "structure", + "members": { + "invocationArn": { + "target": "com.amazonaws.bedrockruntime#InvocationArn", + "traits": { + "smithy.api#documentation": "

The invocation's ARN.

", + "smithy.api#httpLabel": {}, + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#input": {} + } + }, + "com.amazonaws.bedrockruntime#GetAsyncInvokeResponse": { + "type": "structure", + "members": { + "invocationArn": { + "target": "com.amazonaws.bedrockruntime#InvocationArn", + "traits": { + "smithy.api#documentation": "

The invocation's ARN.

", + "smithy.api#required": {} + } + }, + "modelArn": { + "target": "com.amazonaws.bedrockruntime#AsyncInvokeArn", + "traits": { + "smithy.api#documentation": "

The invocation's model ARN.

", + "smithy.api#required": {} + } + }, + "clientRequestToken": { + "target": "com.amazonaws.bedrockruntime#AsyncInvokeIdempotencyToken", + "traits": { + "smithy.api#documentation": "

The invocation's idempotency token.

" + } + }, + "status": { + "target": "com.amazonaws.bedrockruntime#AsyncInvokeStatus", + "traits": { + "smithy.api#documentation": "

The invocation's status.

", + "smithy.api#required": {} + } + }, + "failureMessage": { + "target": "com.amazonaws.bedrockruntime#AsyncInvokeMessage", + "traits": { + "smithy.api#documentation": "

An error message.

" + } + }, + "submitTime": { + "target": "com.amazonaws.bedrockruntime#Timestamp", + "traits": { + "smithy.api#documentation": "

When the invocation request was submitted.

", + "smithy.api#required": {} + } + }, + "lastModifiedTime": { + "target": "com.amazonaws.bedrockruntime#Timestamp", + "traits": { + "smithy.api#documentation": "

The invocation's last modified time.

" + } + }, + "endTime": { + "target": "com.amazonaws.bedrockruntime#Timestamp", + "traits": { + "smithy.api#documentation": "

When the invocation ended.

" + } + }, + "outputDataConfig": { + "target": "com.amazonaws.bedrockruntime#AsyncInvokeOutputDataConfig", + "traits": { + "smithy.api#documentation": "

Output data settings.

", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#output": {} + } + }, "com.amazonaws.bedrockruntime#GuardrailAction": { "type": "enum", "members": { @@ -3056,6 +3400,16 @@ "smithy.api#httpError": 500 } }, + "com.amazonaws.bedrockruntime#InvocationArn": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 2048 + }, + "smithy.api#pattern": "^arn:aws(-[^:]+)?:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:async-invoke/[a-z0-9]{12}$" + } + }, "com.amazonaws.bedrockruntime#InvokeModel": { "type": "operation", "input": { @@ -3361,27 +3715,163 @@ "smithy.api#output": {} } }, - "com.amazonaws.bedrockruntime#Message": { - "type": "structure", - "members": { - "role": { - "target": "com.amazonaws.bedrockruntime#ConversationRole", - "traits": { - "smithy.api#documentation": "

The role that the message plays in the message.

", - "smithy.api#required": {} - } - }, - "content": { - "target": "com.amazonaws.bedrockruntime#ContentBlocks", - "traits": { - "smithy.api#documentation": "

The message content. Note the following restrictions:

\n
    \n
  • \n

    You can include up to 20 images. Each image's size, height, and width must be no more than 3.75 MB, 8000 px, and 8000 px, respectively.

    \n
  • \n
  • \n

    You can include up to five documents. Each document's size must be no more than 4.5 MB.

    \n
  • \n
  • \n

    If you include a ContentBlock with a document field in the array, you must also include a ContentBlock with a text field.

    \n
  • \n
  • \n

    You can only include images and documents if the role is user.

    \n
  • \n
", - "smithy.api#required": {} - } - } - }, + "com.amazonaws.bedrockruntime#KmsKeyId": { + "type": "string", "traits": { - "smithy.api#documentation": "

A message input, or returned from, a call to Converse or ConverseStream.

" - } + "smithy.api#length": { + "min": 1, + "max": 2048 + }, + "smithy.api#pattern": "^arn:aws(-[^:]+)?:kms:[a-zA-Z0-9-]*:[0-9]{12}:((key/[a-zA-Z0-9-]{36})|(alias/[a-zA-Z0-9-_/]+))$" + } + }, + "com.amazonaws.bedrockruntime#ListAsyncInvokes": { + "type": "operation", + "input": { + "target": "com.amazonaws.bedrockruntime#ListAsyncInvokesRequest" + }, + "output": { + "target": "com.amazonaws.bedrockruntime#ListAsyncInvokesResponse" + }, + "errors": [ + { + "target": "com.amazonaws.bedrockruntime#AccessDeniedException" + }, + { + "target": "com.amazonaws.bedrockruntime#InternalServerException" + }, + { + "target": "com.amazonaws.bedrockruntime#ThrottlingException" + }, + { + "target": "com.amazonaws.bedrockruntime#ValidationException" + } + ], + "traits": { + "smithy.api#documentation": "

Lists asynchronous invocations.

", + "smithy.api#http": { + "code": 200, + "method": "GET", + "uri": "/async-invoke" + }, + "smithy.api#paginated": { + "inputToken": "nextToken", + "outputToken": "nextToken", + "pageSize": "maxResults", + "items": "asyncInvokeSummaries" + }, + "smithy.api#readonly": {} + } + }, + "com.amazonaws.bedrockruntime#ListAsyncInvokesRequest": { + "type": "structure", + "members": { + "submitTimeAfter": { + "target": "com.amazonaws.bedrockruntime#Timestamp", + "traits": { + "smithy.api#documentation": "

Include invocations submitted after this time.

", + "smithy.api#httpQuery": "submitTimeAfter" + } + }, + "submitTimeBefore": { + "target": "com.amazonaws.bedrockruntime#Timestamp", + "traits": { + "smithy.api#documentation": "

Include invocations submitted before this time.

", + "smithy.api#httpQuery": "submitTimeBefore" + } + }, + "statusEquals": { + "target": "com.amazonaws.bedrockruntime#AsyncInvokeStatus", + "traits": { + "smithy.api#documentation": "

Filter invocations by status.

", + "smithy.api#httpQuery": "statusEquals" + } + }, + "maxResults": { + "target": "com.amazonaws.bedrockruntime#MaxResults", + "traits": { + "smithy.api#documentation": "

The maximum number of invocations to return in one page of results.

", + "smithy.api#httpQuery": "maxResults" + } + }, + "nextToken": { + "target": "com.amazonaws.bedrockruntime#PaginationToken", + "traits": { + "smithy.api#documentation": "

Specify the pagination token from a previous request to retrieve the next page of results.

", + "smithy.api#httpQuery": "nextToken" + } + }, + "sortBy": { + "target": "com.amazonaws.bedrockruntime#SortAsyncInvocationBy", + "traits": { + "smithy.api#default": "SubmissionTime", + "smithy.api#documentation": "

How to sort the response.

", + "smithy.api#httpQuery": "sortBy" + } + }, + "sortOrder": { + "target": "com.amazonaws.bedrockruntime#SortOrder", + "traits": { + "smithy.api#default": "Descending", + "smithy.api#documentation": "

The sorting order for the response.

", + "smithy.api#httpQuery": "sortOrder" + } + } + }, + "traits": { + "smithy.api#input": {} + } + }, + "com.amazonaws.bedrockruntime#ListAsyncInvokesResponse": { + "type": "structure", + "members": { + "nextToken": { + "target": "com.amazonaws.bedrockruntime#PaginationToken", + "traits": { + "smithy.api#documentation": "

Specify the pagination token from a previous request to retrieve the next page of results.

" + } + }, + "asyncInvokeSummaries": { + "target": "com.amazonaws.bedrockruntime#AsyncInvokeSummaries", + "traits": { + "smithy.api#documentation": "

A list of invocation summaries.

" + } + } + }, + "traits": { + "smithy.api#output": {} + } + }, + "com.amazonaws.bedrockruntime#MaxResults": { + "type": "integer", + "traits": { + "smithy.api#range": { + "min": 1, + "max": 1000 + } + } + }, + "com.amazonaws.bedrockruntime#Message": { + "type": "structure", + "members": { + "role": { + "target": "com.amazonaws.bedrockruntime#ConversationRole", + "traits": { + "smithy.api#documentation": "

The role that the message plays in the message.

", + "smithy.api#required": {} + } + }, + "content": { + "target": "com.amazonaws.bedrockruntime#ContentBlocks", + "traits": { + "smithy.api#documentation": "

The message content. Note the following restrictions:

\n
    \n
  • \n

    You can include up to 20 images. Each image's size, height, and width must be no more than 3.75 MB, 8000 px, and 8000 px, respectively.

    \n
  • \n
  • \n

    You can include up to five documents. Each document's size must be no more than 4.5 MB.

    \n
  • \n
  • \n

    If you include a ContentBlock with a document field in the array, you must also include a ContentBlock with a text field.

    \n
  • \n
  • \n

    You can only include images and documents if the role is user.

    \n
  • \n
", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#documentation": "

A message input, or returned from, a call to Converse or ConverseStream.

" + } }, "com.amazonaws.bedrockruntime#MessageStartEvent": { "type": "structure", @@ -3453,6 +3943,12 @@ "smithy.api#httpError": 424 } }, + "com.amazonaws.bedrockruntime#ModelInputPayload": { + "type": "document", + "traits": { + "smithy.api#sensitive": {} + } + }, "com.amazonaws.bedrockruntime#ModelNotReadyException": { "type": "structure", "members": { @@ -3539,6 +4035,16 @@ } } }, + "com.amazonaws.bedrockruntime#PaginationToken": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 2048 + }, + "smithy.api#pattern": "^\\S*$" + } + }, "com.amazonaws.bedrockruntime#PartBody": { "type": "blob", "traits": { @@ -3621,6 +4127,36 @@ "smithy.api#documentation": "

Contains a map of variables in a prompt from Prompt management to an object containing the values to fill in for them when running model invocation. For more information, see How Prompt management works.

" } }, + "com.amazonaws.bedrockruntime#RequestMetadata": { + "type": "map", + "key": { + "target": "smithy.api#String", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 256 + }, + "smithy.api#pattern": "^[a-zA-Z0-9\\s:_@$#=/+,-.]{1,256}$" + } + }, + "value": { + "target": "smithy.api#String", + "traits": { + "smithy.api#length": { + "min": 0, + "max": 256 + }, + "smithy.api#pattern": "^[a-zA-Z0-9\\s:_@$#=/+,-.]{0,256}$" + } + }, + "traits": { + "smithy.api#length": { + "min": 1, + "max": 16 + }, + "smithy.api#sensitive": {} + } + }, "com.amazonaws.bedrockruntime#ResourceNotFoundException": { "type": "structure", "members": { @@ -3685,6 +4221,37 @@ "smithy.api#streaming": {} } }, + "com.amazonaws.bedrockruntime#S3Location": { + "type": "structure", + "members": { + "uri": { + "target": "com.amazonaws.bedrockruntime#S3Uri", + "traits": { + "smithy.api#documentation": "

An object URI starting with s3://.

", + "smithy.api#required": {} + } + }, + "bucketOwner": { + "target": "com.amazonaws.bedrockruntime#AccountId", + "traits": { + "smithy.api#documentation": "

If the bucket belongs to another AWS account, specify that account's ID.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

A storage location in an S3 bucket.

" + } + }, + "com.amazonaws.bedrockruntime#S3Uri": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 1024 + }, + "smithy.api#pattern": "^s3://[a-z0-9][\\.\\-a-z0-9]{1,61}[a-z0-9](/.*)?$" + } + }, "com.amazonaws.bedrockruntime#ServiceQuotaExceededException": { "type": "structure", "members": { @@ -3711,6 +4278,34 @@ "smithy.api#httpError": 503 } }, + "com.amazonaws.bedrockruntime#SortAsyncInvocationBy": { + "type": "enum", + "members": { + "SUBMISSION_TIME": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "SubmissionTime" + } + } + } + }, + "com.amazonaws.bedrockruntime#SortOrder": { + "type": "enum", + "members": { + "ASCENDING": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "Ascending" + } + }, + "DESCENDING": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "Descending" + } + } + } + }, "com.amazonaws.bedrockruntime#SpecificToolChoice": { "type": "structure", "members": { @@ -3726,6 +4321,107 @@ "smithy.api#documentation": "

The model must request a specific tool. For example, {\"tool\" : {\"name\" : \"Your tool name\"}}.

\n \n

This field is only supported by Anthropic Claude 3 models.

\n
" } }, + "com.amazonaws.bedrockruntime#StartAsyncInvoke": { + "type": "operation", + "input": { + "target": "com.amazonaws.bedrockruntime#StartAsyncInvokeRequest" + }, + "output": { + "target": "com.amazonaws.bedrockruntime#StartAsyncInvokeResponse" + }, + "errors": [ + { + "target": "com.amazonaws.bedrockruntime#AccessDeniedException" + }, + { + "target": "com.amazonaws.bedrockruntime#ConflictException" + }, + { + "target": "com.amazonaws.bedrockruntime#InternalServerException" + }, + { + "target": "com.amazonaws.bedrockruntime#ResourceNotFoundException" + }, + { + "target": "com.amazonaws.bedrockruntime#ServiceQuotaExceededException" + }, + { + "target": "com.amazonaws.bedrockruntime#ServiceUnavailableException" + }, + { + "target": "com.amazonaws.bedrockruntime#ThrottlingException" + }, + { + "target": "com.amazonaws.bedrockruntime#ValidationException" + } + ], + "traits": { + "smithy.api#documentation": "

Starts an asynchronous invocation.

\n

This operation requires permission for the bedrock:InvokeModel action.

\n \n

To deny all inference access to resources that you specify in the modelId field, you\n need to deny access to the bedrock:InvokeModel and\n bedrock:InvokeModelWithResponseStream actions. Doing this also denies\n access to the resource through the Converse API actions (Converse and ConverseStream). For more information see Deny access for inference on specific models.\n

\n
", + "smithy.api#http": { + "code": 200, + "method": "POST", + "uri": "/async-invoke" + }, + "smithy.api#idempotent": {} + } + }, + "com.amazonaws.bedrockruntime#StartAsyncInvokeRequest": { + "type": "structure", + "members": { + "clientRequestToken": { + "target": "com.amazonaws.bedrockruntime#AsyncInvokeIdempotencyToken", + "traits": { + "smithy.api#documentation": "

Specify idempotency token to ensure that requests are not duplicated.

", + "smithy.api#idempotencyToken": {} + } + }, + "modelId": { + "target": "com.amazonaws.bedrockruntime#AsyncInvokeIdentifier", + "traits": { + "smithy.api#documentation": "

The model to invoke.

", + "smithy.api#required": {} + } + }, + "modelInput": { + "target": "com.amazonaws.bedrockruntime#ModelInputPayload", + "traits": { + "smithy.api#documentation": "

Input to send to the model.

", + "smithy.api#required": {} + } + }, + "outputDataConfig": { + "target": "com.amazonaws.bedrockruntime#AsyncInvokeOutputDataConfig", + "traits": { + "smithy.api#documentation": "

Where to store the output.

", + "smithy.api#required": {} + } + }, + "tags": { + "target": "com.amazonaws.bedrockruntime#TagList", + "traits": { + "smithy.api#documentation": "

Tags to apply to the invocation.

" + } + } + }, + "traits": { + "smithy.api#input": {} + } + }, + "com.amazonaws.bedrockruntime#StartAsyncInvokeResponse": { + "type": "structure", + "members": { + "invocationArn": { + "target": "com.amazonaws.bedrockruntime#InvocationArn", + "traits": { + "smithy.api#documentation": "

The ARN of the invocation.

", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#output": {} + } + }, "com.amazonaws.bedrockruntime#StatusCode": { "type": "integer", "traits": { @@ -3802,6 +4498,60 @@ "target": "com.amazonaws.bedrockruntime#SystemContentBlock" } }, + "com.amazonaws.bedrockruntime#Tag": { + "type": "structure", + "members": { + "key": { + "target": "com.amazonaws.bedrockruntime#TagKey", + "traits": { + "smithy.api#documentation": "

The tag's key.

", + "smithy.api#required": {} + } + }, + "value": { + "target": "com.amazonaws.bedrockruntime#TagValue", + "traits": { + "smithy.api#documentation": "

The tag's value.

", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#documentation": "

A tag.

" + } + }, + "com.amazonaws.bedrockruntime#TagKey": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 128 + }, + "smithy.api#pattern": "^[a-zA-Z0-9\\s._:/=+@-]*$" + } + }, + "com.amazonaws.bedrockruntime#TagList": { + "type": "list", + "member": { + "target": "com.amazonaws.bedrockruntime#Tag" + }, + "traits": { + "smithy.api#length": { + "min": 0, + "max": 200 + } + } + }, + "com.amazonaws.bedrockruntime#TagValue": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 0, + "max": 256 + }, + "smithy.api#pattern": "^[a-zA-Z0-9\\s._:/=+@-]*$" + } + }, "com.amazonaws.bedrockruntime#TextCharactersGuarded": { "type": "integer" }, @@ -3821,6 +4571,12 @@ "smithy.api#httpError": 429 } }, + "com.amazonaws.bedrockruntime#Timestamp": { + "type": "timestamp", + "traits": { + "smithy.api#timestampFormat": "date-time" + } + }, "com.amazonaws.bedrockruntime#TokenUsage": { "type": "structure", "members": { @@ -3920,7 +4676,7 @@ } }, "traits": { - "smithy.api#documentation": "

Configuration information for the tools that you pass to a model. For more information, see Tool use (function calling) in the Amazon Bedrock User Guide.

\n \n

This field is only supported by Anthropic Claude 3, Cohere Command R, Cohere Command R+, and Mistral Large models.

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

Configuration information for the tools that you pass to a model. For more information, see Tool use (function calling) in the Amazon Bedrock User Guide.

" } }, "com.amazonaws.bedrockruntime#ToolInputSchema": { @@ -4001,6 +4757,12 @@ "traits": { "smithy.api#documentation": "

A tool result that is a document.

" } + }, + "video": { + "target": "com.amazonaws.bedrockruntime#VideoBlock", + "traits": { + "smithy.api#documentation": "

A tool result that is video.

" + } } }, "traits": { @@ -4169,6 +4931,110 @@ "smithy.api#error": "client", "smithy.api#httpError": 400 } + }, + "com.amazonaws.bedrockruntime#VideoBlock": { + "type": "structure", + "members": { + "format": { + "target": "com.amazonaws.bedrockruntime#VideoFormat", + "traits": { + "smithy.api#documentation": "

The block's format.

", + "smithy.api#required": {} + } + }, + "source": { + "target": "com.amazonaws.bedrockruntime#VideoSource", + "traits": { + "smithy.api#documentation": "

The block's source.

", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#documentation": "

A video block.

" + } + }, + "com.amazonaws.bedrockruntime#VideoFormat": { + "type": "enum", + "members": { + "MKV": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "mkv" + } + }, + "MOV": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "mov" + } + }, + "MP4": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "mp4" + } + }, + "WEBM": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "webm" + } + }, + "FLV": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "flv" + } + }, + "MPEG": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "mpeg" + } + }, + "MPG": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "mpg" + } + }, + "WMV": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "wmv" + } + }, + "THREE_GP": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "three_gp" + } + } + } + }, + "com.amazonaws.bedrockruntime#VideoSource": { + "type": "union", + "members": { + "bytes": { + "target": "smithy.api#Blob", + "traits": { + "smithy.api#documentation": "

Video content encoded in base64.

", + "smithy.api#length": { + "min": 1 + } + } + }, + "s3Location": { + "target": "com.amazonaws.bedrockruntime#S3Location", + "traits": { + "smithy.api#documentation": "

The location of a video object in an S3 bucket.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

A video source. You can upload a smaller video as a base64-encoded string as\n long as the encoded file is less than 25MB. You can also transfer videos up to 1GB in size\n from an S3 bucket.

" + } } } }