Skip to content

Commit 512d901

Browse files
author
awstools
committedMay 30, 2024
feat(client-bedrock-runtime): This release adds Converse and ConverseStream APIs to Bedrock Runtime
1 parent 8cdaf0a commit 512d901

File tree

9 files changed

+4190
-320
lines changed

9 files changed

+4190
-320
lines changed
 

‎clients/client-bedrock-runtime/README.md

+23-7
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ using your favorite package manager:
2323

2424
The AWS SDK is modulized by clients and commands.
2525
To send a request, you only need to import the `BedrockRuntimeClient` and
26-
the commands you need, for example `InvokeModelCommand`:
26+
the commands you need, for example `ConverseCommand`:
2727

2828
```js
2929
// ES5 example
30-
const { BedrockRuntimeClient, InvokeModelCommand } = require("@aws-sdk/client-bedrock-runtime");
30+
const { BedrockRuntimeClient, ConverseCommand } = require("@aws-sdk/client-bedrock-runtime");
3131
```
3232

3333
```ts
3434
// ES6+ example
35-
import { BedrockRuntimeClient, InvokeModelCommand } from "@aws-sdk/client-bedrock-runtime";
35+
import { BedrockRuntimeClient, ConverseCommand } from "@aws-sdk/client-bedrock-runtime";
3636
```
3737

3838
### Usage
@@ -51,7 +51,7 @@ const client = new BedrockRuntimeClient({ region: "REGION" });
5151
const params = {
5252
/** input parameters */
5353
};
54-
const command = new InvokeModelCommand(params);
54+
const command = new ConverseCommand(params);
5555
```
5656

5757
#### Async/await
@@ -130,15 +130,15 @@ const client = new AWS.BedrockRuntime({ region: "REGION" });
130130

131131
// async/await.
132132
try {
133-
const data = await client.invokeModel(params);
133+
const data = await client.converse(params);
134134
// process data.
135135
} catch (error) {
136136
// error handling.
137137
}
138138

139139
// Promises.
140140
client
141-
.invokeModel(params)
141+
.converse(params)
142142
.then((data) => {
143143
// process data.
144144
})
@@ -147,7 +147,7 @@ client
147147
});
148148

149149
// callbacks.
150-
client.invokeModel(params, (err, data) => {
150+
client.converse(params, (err, data) => {
151151
// process err and data.
152152
});
153153
```
@@ -203,6 +203,22 @@ see LICENSE for more information.
203203

204204
## Client Commands (Operations List)
205205

206+
<details>
207+
<summary>
208+
Converse
209+
</summary>
210+
211+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock-runtime/command/ConverseCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-runtime/Interface/ConverseCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-runtime/Interface/ConverseCommandOutput/)
212+
213+
</details>
214+
<details>
215+
<summary>
216+
ConverseStream
217+
</summary>
218+
219+
[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/)
220+
221+
</details>
206222
<details>
207223
<summary>
208224
InvokeModel

‎clients/client-bedrock-runtime/src/BedrockRuntime.ts

+33
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ import { createAggregatedClient } from "@smithy/smithy-client";
33
import { HttpHandlerOptions as __HttpHandlerOptions } from "@smithy/types";
44

55
import { BedrockRuntimeClient, BedrockRuntimeClientConfig } from "./BedrockRuntimeClient";
6+
import { ConverseCommand, ConverseCommandInput, ConverseCommandOutput } from "./commands/ConverseCommand";
7+
import {
8+
ConverseStreamCommand,
9+
ConverseStreamCommandInput,
10+
ConverseStreamCommandOutput,
11+
} from "./commands/ConverseStreamCommand";
612
import { InvokeModelCommand, InvokeModelCommandInput, InvokeModelCommandOutput } from "./commands/InvokeModelCommand";
713
import {
814
InvokeModelWithResponseStreamCommand,
@@ -11,11 +17,38 @@ import {
1117
} from "./commands/InvokeModelWithResponseStreamCommand";
1218

1319
const commands = {
20+
ConverseCommand,
21+
ConverseStreamCommand,
1422
InvokeModelCommand,
1523
InvokeModelWithResponseStreamCommand,
1624
};
1725

1826
export interface BedrockRuntime {
27+
/**
28+
* @see {@link ConverseCommand}
29+
*/
30+
converse(args: ConverseCommandInput, options?: __HttpHandlerOptions): Promise<ConverseCommandOutput>;
31+
converse(args: ConverseCommandInput, cb: (err: any, data?: ConverseCommandOutput) => void): void;
32+
converse(
33+
args: ConverseCommandInput,
34+
options: __HttpHandlerOptions,
35+
cb: (err: any, data?: ConverseCommandOutput) => void
36+
): void;
37+
38+
/**
39+
* @see {@link ConverseStreamCommand}
40+
*/
41+
converseStream(
42+
args: ConverseStreamCommandInput,
43+
options?: __HttpHandlerOptions
44+
): Promise<ConverseStreamCommandOutput>;
45+
converseStream(args: ConverseStreamCommandInput, cb: (err: any, data?: ConverseStreamCommandOutput) => void): void;
46+
converseStream(
47+
args: ConverseStreamCommandInput,
48+
options: __HttpHandlerOptions,
49+
cb: (err: any, data?: ConverseStreamCommandOutput) => void
50+
): void;
51+
1952
/**
2053
* @see {@link InvokeModelCommand}
2154
*/

‎clients/client-bedrock-runtime/src/BedrockRuntimeClient.ts

+12-2
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ import {
5959
HttpAuthSchemeResolvedConfig,
6060
resolveHttpAuthSchemeConfig,
6161
} from "./auth/httpAuthSchemeProvider";
62+
import { ConverseCommandInput, ConverseCommandOutput } from "./commands/ConverseCommand";
63+
import { ConverseStreamCommandInput, ConverseStreamCommandOutput } from "./commands/ConverseStreamCommand";
6264
import { InvokeModelCommandInput, InvokeModelCommandOutput } from "./commands/InvokeModelCommand";
6365
import {
6466
InvokeModelWithResponseStreamCommandInput,
@@ -78,12 +80,20 @@ export { __Client };
7880
/**
7981
* @public
8082
*/
81-
export type ServiceInputTypes = InvokeModelCommandInput | InvokeModelWithResponseStreamCommandInput;
83+
export type ServiceInputTypes =
84+
| ConverseCommandInput
85+
| ConverseStreamCommandInput
86+
| InvokeModelCommandInput
87+
| InvokeModelWithResponseStreamCommandInput;
8288

8389
/**
8490
* @public
8591
*/
86-
export type ServiceOutputTypes = InvokeModelCommandOutput | InvokeModelWithResponseStreamCommandOutput;
92+
export type ServiceOutputTypes =
93+
| ConverseCommandOutput
94+
| ConverseStreamCommandOutput
95+
| InvokeModelCommandOutput
96+
| InvokeModelWithResponseStreamCommandOutput;
8797

8898
/**
8999
* @public
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
1+
// smithy-typescript generated code
2+
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
3+
import { getSerdePlugin } from "@smithy/middleware-serde";
4+
import { Command as $Command } from "@smithy/smithy-client";
5+
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
6+
7+
import { BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../BedrockRuntimeClient";
8+
import { commonParams } from "../endpoint/EndpointParameters";
9+
import { ConverseRequest, ConverseResponse } from "../models/models_0";
10+
import { de_ConverseCommand, se_ConverseCommand } from "../protocols/Aws_restJson1";
11+
12+
/**
13+
* @public
14+
*/
15+
export { __MetadataBearer, $Command };
16+
/**
17+
* @public
18+
*
19+
* The input for {@link ConverseCommand}.
20+
*/
21+
export interface ConverseCommandInput extends ConverseRequest {}
22+
/**
23+
* @public
24+
*
25+
* The output of {@link ConverseCommand}.
26+
*/
27+
export interface ConverseCommandOutput extends ConverseResponse, __MetadataBearer {}
28+
29+
/**
30+
* <p>Sends messages to the specified Amazon Bedrock model. <code>Converse</code> provides
31+
* a consistent interface that works with all models that
32+
* support messages. This allows you to write code once and use it with different models.
33+
* Should a model have unique inference parameters, you can also pass those unique parameters
34+
* to the model. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/api-methods-run.html">Run inference</a> in the Bedrock User Guide.</p>
35+
* <p>This operation requires permission for the <code>bedrock:InvokeModel</code> action. </p>
36+
* @example
37+
* Use a bare-bones client and the command you need to make an API call.
38+
* ```javascript
39+
* import { BedrockRuntimeClient, ConverseCommand } from "@aws-sdk/client-bedrock-runtime"; // ES Modules import
40+
* // const { BedrockRuntimeClient, ConverseCommand } = require("@aws-sdk/client-bedrock-runtime"); // CommonJS import
41+
* const client = new BedrockRuntimeClient(config);
42+
* const input = { // ConverseRequest
43+
* modelId: "STRING_VALUE", // required
44+
* messages: [ // Messages // required
45+
* { // Message
46+
* role: "user" || "assistant", // required
47+
* content: [ // ContentBlocks // required
48+
* { // ContentBlock Union: only one key present
49+
* text: "STRING_VALUE",
50+
* image: { // ImageBlock
51+
* format: "png" || "jpeg" || "gif" || "webp", // required
52+
* source: { // ImageSource Union: only one key present
53+
* bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
54+
* },
55+
* },
56+
* toolUse: { // ToolUseBlock
57+
* toolUseId: "STRING_VALUE", // required
58+
* name: "STRING_VALUE", // required
59+
* input: "DOCUMENT_VALUE", // required
60+
* },
61+
* toolResult: { // ToolResultBlock
62+
* toolUseId: "STRING_VALUE", // required
63+
* content: [ // ToolResultContentBlocks // required
64+
* { // ToolResultContentBlock Union: only one key present
65+
* json: "DOCUMENT_VALUE",
66+
* text: "STRING_VALUE",
67+
* image: {
68+
* format: "png" || "jpeg" || "gif" || "webp", // required
69+
* source: {// Union: only one key present
70+
* bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
71+
* },
72+
* },
73+
* },
74+
* ],
75+
* status: "success" || "error",
76+
* },
77+
* },
78+
* ],
79+
* },
80+
* ],
81+
* system: [ // SystemContentBlocks
82+
* { // SystemContentBlock Union: only one key present
83+
* text: "STRING_VALUE",
84+
* },
85+
* ],
86+
* inferenceConfig: { // InferenceConfiguration
87+
* maxTokens: Number("int"),
88+
* temperature: Number("float"),
89+
* topP: Number("float"),
90+
* stopSequences: [ // NonEmptyStringList
91+
* "STRING_VALUE",
92+
* ],
93+
* },
94+
* toolConfig: { // ToolConfiguration
95+
* tools: [ // Tools // required
96+
* { // Tool Union: only one key present
97+
* toolSpec: { // ToolSpecification
98+
* name: "STRING_VALUE", // required
99+
* description: "STRING_VALUE",
100+
* inputSchema: { // ToolInputSchema Union: only one key present
101+
* json: "DOCUMENT_VALUE",
102+
* },
103+
* },
104+
* },
105+
* ],
106+
* toolChoice: { // ToolChoice Union: only one key present
107+
* auto: {},
108+
* any: {},
109+
* tool: { // SpecificToolChoice
110+
* name: "STRING_VALUE", // required
111+
* },
112+
* },
113+
* },
114+
* additionalModelRequestFields: "DOCUMENT_VALUE",
115+
* additionalModelResponseFieldPaths: [ // AdditionalModelResponseFieldPaths
116+
* "STRING_VALUE",
117+
* ],
118+
* };
119+
* const command = new ConverseCommand(input);
120+
* const response = await client.send(command);
121+
* // { // ConverseResponse
122+
* // output: { // ConverseOutput Union: only one key present
123+
* // message: { // Message
124+
* // role: "user" || "assistant", // required
125+
* // content: [ // ContentBlocks // required
126+
* // { // ContentBlock Union: only one key present
127+
* // text: "STRING_VALUE",
128+
* // image: { // ImageBlock
129+
* // format: "png" || "jpeg" || "gif" || "webp", // required
130+
* // source: { // ImageSource Union: only one key present
131+
* // bytes: new Uint8Array(),
132+
* // },
133+
* // },
134+
* // toolUse: { // ToolUseBlock
135+
* // toolUseId: "STRING_VALUE", // required
136+
* // name: "STRING_VALUE", // required
137+
* // input: "DOCUMENT_VALUE", // required
138+
* // },
139+
* // toolResult: { // ToolResultBlock
140+
* // toolUseId: "STRING_VALUE", // required
141+
* // content: [ // ToolResultContentBlocks // required
142+
* // { // ToolResultContentBlock Union: only one key present
143+
* // json: "DOCUMENT_VALUE",
144+
* // text: "STRING_VALUE",
145+
* // image: {
146+
* // format: "png" || "jpeg" || "gif" || "webp", // required
147+
* // source: {// Union: only one key present
148+
* // bytes: new Uint8Array(),
149+
* // },
150+
* // },
151+
* // },
152+
* // ],
153+
* // status: "success" || "error",
154+
* // },
155+
* // },
156+
* // ],
157+
* // },
158+
* // },
159+
* // stopReason: "end_turn" || "tool_use" || "max_tokens" || "stop_sequence" || "content_filtered", // required
160+
* // usage: { // TokenUsage
161+
* // inputTokens: Number("int"), // required
162+
* // outputTokens: Number("int"), // required
163+
* // totalTokens: Number("int"), // required
164+
* // },
165+
* // metrics: { // ConverseMetrics
166+
* // latencyMs: Number("long"), // required
167+
* // },
168+
* // additionalModelResponseFields: "DOCUMENT_VALUE",
169+
* // };
170+
*
171+
* ```
172+
*
173+
* @param ConverseCommandInput - {@link ConverseCommandInput}
174+
* @returns {@link ConverseCommandOutput}
175+
* @see {@link ConverseCommandInput} for command's `input` shape.
176+
* @see {@link ConverseCommandOutput} for command's `response` shape.
177+
* @see {@link BedrockRuntimeClientResolvedConfig | config} for BedrockRuntimeClient's `config` shape.
178+
*
179+
* @throws {@link AccessDeniedException} (client fault)
180+
* <p>The request is denied because of missing access permissions.</p>
181+
*
182+
* @throws {@link InternalServerException} (server fault)
183+
* <p>An internal server error occurred. Retry your request.</p>
184+
*
185+
* @throws {@link ModelErrorException} (client fault)
186+
* <p>The request failed due to an error while processing the model.</p>
187+
*
188+
* @throws {@link ModelNotReadyException} (client fault)
189+
* <p>The model specified in the request is not ready to serve inference requests.</p>
190+
*
191+
* @throws {@link ModelTimeoutException} (client fault)
192+
* <p>The request took too long to process. Processing time exceeded the model timeout length.</p>
193+
*
194+
* @throws {@link ResourceNotFoundException} (client fault)
195+
* <p>The specified resource ARN was not found. Check the ARN and try your request again.</p>
196+
*
197+
* @throws {@link ThrottlingException} (client fault)
198+
* <p>The number of requests exceeds the limit. Resubmit your request later.</p>
199+
*
200+
* @throws {@link ValidationException} (client fault)
201+
* <p>Input validation failed. Check your request parameters and retry the request.</p>
202+
*
203+
* @throws {@link BedrockRuntimeServiceException}
204+
* <p>Base exception class for all service exceptions from BedrockRuntime service.</p>
205+
*
206+
* @public
207+
*/
208+
export class ConverseCommand extends $Command
209+
.classBuilder<
210+
ConverseCommandInput,
211+
ConverseCommandOutput,
212+
BedrockRuntimeClientResolvedConfig,
213+
ServiceInputTypes,
214+
ServiceOutputTypes
215+
>()
216+
.ep({
217+
...commonParams,
218+
})
219+
.m(function (this: any, Command: any, cs: any, config: BedrockRuntimeClientResolvedConfig, o: any) {
220+
return [
221+
getSerdePlugin(config, this.serialize, this.deserialize),
222+
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
223+
];
224+
})
225+
.s("AmazonBedrockFrontendService", "Converse", {})
226+
.n("BedrockRuntimeClient", "ConverseCommand")
227+
.f(void 0, void 0)
228+
.ser(se_ConverseCommand)
229+
.de(de_ConverseCommand)
230+
.build() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,254 @@
1+
// smithy-typescript generated code
2+
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
3+
import { getSerdePlugin } from "@smithy/middleware-serde";
4+
import { Command as $Command } from "@smithy/smithy-client";
5+
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
6+
7+
import { BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../BedrockRuntimeClient";
8+
import { commonParams } from "../endpoint/EndpointParameters";
9+
import {
10+
ConverseStreamRequest,
11+
ConverseStreamResponse,
12+
ConverseStreamResponseFilterSensitiveLog,
13+
} from "../models/models_0";
14+
import { de_ConverseStreamCommand, se_ConverseStreamCommand } from "../protocols/Aws_restJson1";
15+
16+
/**
17+
* @public
18+
*/
19+
export { __MetadataBearer, $Command };
20+
/**
21+
* @public
22+
*
23+
* The input for {@link ConverseStreamCommand}.
24+
*/
25+
export interface ConverseStreamCommandInput extends ConverseStreamRequest {}
26+
/**
27+
* @public
28+
*
29+
* The output of {@link ConverseStreamCommand}.
30+
*/
31+
export interface ConverseStreamCommandOutput extends ConverseStreamResponse, __MetadataBearer {}
32+
33+
/**
34+
* <p>Sends messages to the specified Amazon Bedrock model and returns
35+
* the response in a stream. <code>ConverseStream</code> provides a consistent API
36+
* that works with all Amazon Bedrock models that support messages.
37+
* This allows you to write code once and use it with different models. Should a
38+
* model have unique inference parameters, you can also pass those unique parameters to the
39+
* model. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/api-methods-run.html">Run inference</a> in the Bedrock User Guide.</p>
40+
* <p>To find out if a model supports streaming, call <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_GetFoundationModel.html">GetFoundationModel</a>
41+
* and check the <code>responseStreamingSupported</code> field in the response.</p>
42+
* <p>For example code, see <i>Invoke model with streaming code
43+
* example</i> in the <i>Amazon Bedrock User Guide</i>.
44+
* </p>
45+
* <p>This operation requires permission for the <code>bedrock:InvokeModelWithResponseStream</code> action.</p>
46+
* @example
47+
* Use a bare-bones client and the command you need to make an API call.
48+
* ```javascript
49+
* import { BedrockRuntimeClient, ConverseStreamCommand } from "@aws-sdk/client-bedrock-runtime"; // ES Modules import
50+
* // const { BedrockRuntimeClient, ConverseStreamCommand } = require("@aws-sdk/client-bedrock-runtime"); // CommonJS import
51+
* const client = new BedrockRuntimeClient(config);
52+
* const input = { // ConverseStreamRequest
53+
* modelId: "STRING_VALUE", // required
54+
* messages: [ // Messages // required
55+
* { // Message
56+
* role: "user" || "assistant", // required
57+
* content: [ // ContentBlocks // required
58+
* { // ContentBlock Union: only one key present
59+
* text: "STRING_VALUE",
60+
* image: { // ImageBlock
61+
* format: "png" || "jpeg" || "gif" || "webp", // required
62+
* source: { // ImageSource Union: only one key present
63+
* bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
64+
* },
65+
* },
66+
* toolUse: { // ToolUseBlock
67+
* toolUseId: "STRING_VALUE", // required
68+
* name: "STRING_VALUE", // required
69+
* input: "DOCUMENT_VALUE", // required
70+
* },
71+
* toolResult: { // ToolResultBlock
72+
* toolUseId: "STRING_VALUE", // required
73+
* content: [ // ToolResultContentBlocks // required
74+
* { // ToolResultContentBlock Union: only one key present
75+
* json: "DOCUMENT_VALUE",
76+
* text: "STRING_VALUE",
77+
* image: {
78+
* format: "png" || "jpeg" || "gif" || "webp", // required
79+
* source: {// Union: only one key present
80+
* bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
81+
* },
82+
* },
83+
* },
84+
* ],
85+
* status: "success" || "error",
86+
* },
87+
* },
88+
* ],
89+
* },
90+
* ],
91+
* system: [ // SystemContentBlocks
92+
* { // SystemContentBlock Union: only one key present
93+
* text: "STRING_VALUE",
94+
* },
95+
* ],
96+
* inferenceConfig: { // InferenceConfiguration
97+
* maxTokens: Number("int"),
98+
* temperature: Number("float"),
99+
* topP: Number("float"),
100+
* stopSequences: [ // NonEmptyStringList
101+
* "STRING_VALUE",
102+
* ],
103+
* },
104+
* toolConfig: { // ToolConfiguration
105+
* tools: [ // Tools // required
106+
* { // Tool Union: only one key present
107+
* toolSpec: { // ToolSpecification
108+
* name: "STRING_VALUE", // required
109+
* description: "STRING_VALUE",
110+
* inputSchema: { // ToolInputSchema Union: only one key present
111+
* json: "DOCUMENT_VALUE",
112+
* },
113+
* },
114+
* },
115+
* ],
116+
* toolChoice: { // ToolChoice Union: only one key present
117+
* auto: {},
118+
* any: {},
119+
* tool: { // SpecificToolChoice
120+
* name: "STRING_VALUE", // required
121+
* },
122+
* },
123+
* },
124+
* additionalModelRequestFields: "DOCUMENT_VALUE",
125+
* additionalModelResponseFieldPaths: [ // AdditionalModelResponseFieldPaths
126+
* "STRING_VALUE",
127+
* ],
128+
* };
129+
* const command = new ConverseStreamCommand(input);
130+
* const response = await client.send(command);
131+
* // { // ConverseStreamResponse
132+
* // stream: { // ConverseStreamOutput Union: only one key present
133+
* // messageStart: { // MessageStartEvent
134+
* // role: "user" || "assistant", // required
135+
* // },
136+
* // contentBlockStart: { // ContentBlockStartEvent
137+
* // start: { // ContentBlockStart Union: only one key present
138+
* // toolUse: { // ToolUseBlockStart
139+
* // toolUseId: "STRING_VALUE", // required
140+
* // name: "STRING_VALUE", // required
141+
* // },
142+
* // },
143+
* // contentBlockIndex: Number("int"), // required
144+
* // },
145+
* // contentBlockDelta: { // ContentBlockDeltaEvent
146+
* // delta: { // ContentBlockDelta Union: only one key present
147+
* // text: "STRING_VALUE",
148+
* // toolUse: { // ToolUseBlockDelta
149+
* // input: "STRING_VALUE", // required
150+
* // },
151+
* // },
152+
* // contentBlockIndex: Number("int"), // required
153+
* // },
154+
* // contentBlockStop: { // ContentBlockStopEvent
155+
* // contentBlockIndex: Number("int"), // required
156+
* // },
157+
* // messageStop: { // MessageStopEvent
158+
* // stopReason: "end_turn" || "tool_use" || "max_tokens" || "stop_sequence" || "content_filtered", // required
159+
* // additionalModelResponseFields: "DOCUMENT_VALUE",
160+
* // },
161+
* // metadata: { // ConverseStreamMetadataEvent
162+
* // usage: { // TokenUsage
163+
* // inputTokens: Number("int"), // required
164+
* // outputTokens: Number("int"), // required
165+
* // totalTokens: Number("int"), // required
166+
* // },
167+
* // metrics: { // ConverseStreamMetrics
168+
* // latencyMs: Number("long"), // required
169+
* // },
170+
* // },
171+
* // internalServerException: { // InternalServerException
172+
* // message: "STRING_VALUE",
173+
* // },
174+
* // modelStreamErrorException: { // ModelStreamErrorException
175+
* // message: "STRING_VALUE",
176+
* // originalStatusCode: Number("int"),
177+
* // originalMessage: "STRING_VALUE",
178+
* // },
179+
* // validationException: { // ValidationException
180+
* // message: "STRING_VALUE",
181+
* // },
182+
* // throttlingException: { // ThrottlingException
183+
* // message: "STRING_VALUE",
184+
* // },
185+
* // },
186+
* // };
187+
*
188+
* ```
189+
*
190+
* @param ConverseStreamCommandInput - {@link ConverseStreamCommandInput}
191+
* @returns {@link ConverseStreamCommandOutput}
192+
* @see {@link ConverseStreamCommandInput} for command's `input` shape.
193+
* @see {@link ConverseStreamCommandOutput} for command's `response` shape.
194+
* @see {@link BedrockRuntimeClientResolvedConfig | config} for BedrockRuntimeClient's `config` shape.
195+
*
196+
* @throws {@link AccessDeniedException} (client fault)
197+
* <p>The request is denied because of missing access permissions.</p>
198+
*
199+
* @throws {@link InternalServerException} (server fault)
200+
* <p>An internal server error occurred. Retry your request.</p>
201+
*
202+
* @throws {@link ModelErrorException} (client fault)
203+
* <p>The request failed due to an error while processing the model.</p>
204+
*
205+
* @throws {@link ModelNotReadyException} (client fault)
206+
* <p>The model specified in the request is not ready to serve inference requests.</p>
207+
*
208+
* @throws {@link ModelTimeoutException} (client fault)
209+
* <p>The request took too long to process. Processing time exceeded the model timeout length.</p>
210+
*
211+
* @throws {@link ResourceNotFoundException} (client fault)
212+
* <p>The specified resource ARN was not found. Check the ARN and try your request again.</p>
213+
*
214+
* @throws {@link ThrottlingException} (client fault)
215+
* <p>The number of requests exceeds the limit. Resubmit your request later.</p>
216+
*
217+
* @throws {@link ValidationException} (client fault)
218+
* <p>Input validation failed. Check your request parameters and retry the request.</p>
219+
*
220+
* @throws {@link BedrockRuntimeServiceException}
221+
* <p>Base exception class for all service exceptions from BedrockRuntime service.</p>
222+
*
223+
* @public
224+
*/
225+
export class ConverseStreamCommand extends $Command
226+
.classBuilder<
227+
ConverseStreamCommandInput,
228+
ConverseStreamCommandOutput,
229+
BedrockRuntimeClientResolvedConfig,
230+
ServiceInputTypes,
231+
ServiceOutputTypes
232+
>()
233+
.ep({
234+
...commonParams,
235+
})
236+
.m(function (this: any, Command: any, cs: any, config: BedrockRuntimeClientResolvedConfig, o: any) {
237+
return [
238+
getSerdePlugin(config, this.serialize, this.deserialize),
239+
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
240+
];
241+
})
242+
.s("AmazonBedrockFrontendService", "ConverseStream", {
243+
/**
244+
* @internal
245+
*/
246+
eventStream: {
247+
output: true,
248+
},
249+
})
250+
.n("BedrockRuntimeClient", "ConverseStreamCommand")
251+
.f(void 0, ConverseStreamResponseFilterSensitiveLog)
252+
.ser(se_ConverseStreamCommand)
253+
.de(de_ConverseStreamCommand)
254+
.build() {}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
// smithy-typescript generated code
2+
export * from "./ConverseCommand";
3+
export * from "./ConverseStreamCommand";
24
export * from "./InvokeModelCommand";
35
export * from "./InvokeModelWithResponseStreamCommand";

‎clients/client-bedrock-runtime/src/models/models_0.ts

+1,736-196
Large diffs are not rendered by default.

‎clients/client-bedrock-runtime/src/protocols/Aws_restJson1.ts

+621-4
Large diffs are not rendered by default.

‎codegen/sdk-codegen/aws-models/bedrock-runtime.json

+1,279-111
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.