@aws-sdk/client-bedrock-runtime 3.583.0 → 3.587.0

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