@aws-sdk/client-bedrock-runtime 3.583.0 → 3.588.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.
- package/README.md +23 -7
- package/dist-cjs/index.js +653 -31
- package/dist-es/BedrockRuntime.js +4 -0
- package/dist-es/commands/ConverseCommand.js +24 -0
- package/dist-es/commands/ConverseStreamCommand.js +29 -0
- package/dist-es/commands/index.js +2 -0
- package/dist-es/models/models_0.js +187 -16
- package/dist-es/protocols/Aws_restJson1.js +381 -6
- package/dist-types/BedrockRuntime.d.ts +14 -0
- package/dist-types/BedrockRuntimeClient.d.ts +4 -2
- package/dist-types/commands/ConverseCommand.d.ts +208 -0
- package/dist-types/commands/ConverseStreamCommand.d.ts +221 -0
- package/dist-types/commands/index.d.ts +2 -0
- package/dist-types/models/models_0.d.ts +1413 -108
- package/dist-types/protocols/Aws_restJson1.d.ts +18 -0
- package/dist-types/ts3.4/BedrockRuntime.d.ts +34 -0
- package/dist-types/ts3.4/BedrockRuntimeClient.d.ts +12 -0
- package/dist-types/ts3.4/commands/ConverseCommand.d.ts +35 -0
- package/dist-types/ts3.4/commands/ConverseStreamCommand.d.ts +38 -0
- package/dist-types/ts3.4/commands/index.d.ts +2 -0
- package/dist-types/ts3.4/models/models_0.d.ts +602 -33
- package/dist-types/ts3.4/protocols/Aws_restJson1.d.ts +24 -0
- package/package.json +18 -18
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { createAggregatedClient } from "@smithy/smithy-client";
|
|
2
2
|
import { BedrockRuntimeClient } from "./BedrockRuntimeClient";
|
|
3
|
+
import { ConverseCommand } from "./commands/ConverseCommand";
|
|
4
|
+
import { ConverseStreamCommand, } from "./commands/ConverseStreamCommand";
|
|
3
5
|
import { InvokeModelCommand } from "./commands/InvokeModelCommand";
|
|
4
6
|
import { InvokeModelWithResponseStreamCommand, } from "./commands/InvokeModelWithResponseStreamCommand";
|
|
5
7
|
const commands = {
|
|
8
|
+
ConverseCommand,
|
|
9
|
+
ConverseStreamCommand,
|
|
6
10
|
InvokeModelCommand,
|
|
7
11
|
InvokeModelWithResponseStreamCommand,
|
|
8
12
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
|
|
2
|
+
import { getSerdePlugin } from "@smithy/middleware-serde";
|
|
3
|
+
import { Command as $Command } from "@smithy/smithy-client";
|
|
4
|
+
import { commonParams } from "../endpoint/EndpointParameters";
|
|
5
|
+
import { de_ConverseCommand, se_ConverseCommand } from "../protocols/Aws_restJson1";
|
|
6
|
+
export { $Command };
|
|
7
|
+
export class ConverseCommand extends $Command
|
|
8
|
+
.classBuilder()
|
|
9
|
+
.ep({
|
|
10
|
+
...commonParams,
|
|
11
|
+
})
|
|
12
|
+
.m(function (Command, cs, config, o) {
|
|
13
|
+
return [
|
|
14
|
+
getSerdePlugin(config, this.serialize, this.deserialize),
|
|
15
|
+
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
|
|
16
|
+
];
|
|
17
|
+
})
|
|
18
|
+
.s("AmazonBedrockFrontendService", "Converse", {})
|
|
19
|
+
.n("BedrockRuntimeClient", "ConverseCommand")
|
|
20
|
+
.f(void 0, void 0)
|
|
21
|
+
.ser(se_ConverseCommand)
|
|
22
|
+
.de(de_ConverseCommand)
|
|
23
|
+
.build() {
|
|
24
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
|
|
2
|
+
import { getSerdePlugin } from "@smithy/middleware-serde";
|
|
3
|
+
import { Command as $Command } from "@smithy/smithy-client";
|
|
4
|
+
import { commonParams } from "../endpoint/EndpointParameters";
|
|
5
|
+
import { ConverseStreamResponseFilterSensitiveLog, } from "../models/models_0";
|
|
6
|
+
import { de_ConverseStreamCommand, se_ConverseStreamCommand } from "../protocols/Aws_restJson1";
|
|
7
|
+
export { $Command };
|
|
8
|
+
export class ConverseStreamCommand extends $Command
|
|
9
|
+
.classBuilder()
|
|
10
|
+
.ep({
|
|
11
|
+
...commonParams,
|
|
12
|
+
})
|
|
13
|
+
.m(function (Command, cs, config, o) {
|
|
14
|
+
return [
|
|
15
|
+
getSerdePlugin(config, this.serialize, this.deserialize),
|
|
16
|
+
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
|
|
17
|
+
];
|
|
18
|
+
})
|
|
19
|
+
.s("AmazonBedrockFrontendService", "ConverseStream", {
|
|
20
|
+
eventStream: {
|
|
21
|
+
output: true,
|
|
22
|
+
},
|
|
23
|
+
})
|
|
24
|
+
.n("BedrockRuntimeClient", "ConverseStreamCommand")
|
|
25
|
+
.f(void 0, ConverseStreamResponseFilterSensitiveLog)
|
|
26
|
+
.ser(se_ConverseStreamCommand)
|
|
27
|
+
.de(de_ConverseStreamCommand)
|
|
28
|
+
.build() {
|
|
29
|
+
}
|
|
@@ -12,6 +12,105 @@ export class AccessDeniedException extends __BaseException {
|
|
|
12
12
|
Object.setPrototypeOf(this, AccessDeniedException.prototype);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
+
export const ImageFormat = {
|
|
16
|
+
GIF: "gif",
|
|
17
|
+
JPEG: "jpeg",
|
|
18
|
+
PNG: "png",
|
|
19
|
+
WEBP: "webp",
|
|
20
|
+
};
|
|
21
|
+
export var ImageSource;
|
|
22
|
+
(function (ImageSource) {
|
|
23
|
+
ImageSource.visit = (value, visitor) => {
|
|
24
|
+
if (value.bytes !== undefined)
|
|
25
|
+
return visitor.bytes(value.bytes);
|
|
26
|
+
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
27
|
+
};
|
|
28
|
+
})(ImageSource || (ImageSource = {}));
|
|
29
|
+
export var ToolResultContentBlock;
|
|
30
|
+
(function (ToolResultContentBlock) {
|
|
31
|
+
ToolResultContentBlock.visit = (value, visitor) => {
|
|
32
|
+
if (value.json !== undefined)
|
|
33
|
+
return visitor.json(value.json);
|
|
34
|
+
if (value.text !== undefined)
|
|
35
|
+
return visitor.text(value.text);
|
|
36
|
+
if (value.image !== undefined)
|
|
37
|
+
return visitor.image(value.image);
|
|
38
|
+
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
39
|
+
};
|
|
40
|
+
})(ToolResultContentBlock || (ToolResultContentBlock = {}));
|
|
41
|
+
export const ToolResultStatus = {
|
|
42
|
+
ERROR: "error",
|
|
43
|
+
SUCCESS: "success",
|
|
44
|
+
};
|
|
45
|
+
export var ContentBlock;
|
|
46
|
+
(function (ContentBlock) {
|
|
47
|
+
ContentBlock.visit = (value, visitor) => {
|
|
48
|
+
if (value.text !== undefined)
|
|
49
|
+
return visitor.text(value.text);
|
|
50
|
+
if (value.image !== undefined)
|
|
51
|
+
return visitor.image(value.image);
|
|
52
|
+
if (value.toolUse !== undefined)
|
|
53
|
+
return visitor.toolUse(value.toolUse);
|
|
54
|
+
if (value.toolResult !== undefined)
|
|
55
|
+
return visitor.toolResult(value.toolResult);
|
|
56
|
+
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
57
|
+
};
|
|
58
|
+
})(ContentBlock || (ContentBlock = {}));
|
|
59
|
+
export const ConversationRole = {
|
|
60
|
+
ASSISTANT: "assistant",
|
|
61
|
+
USER: "user",
|
|
62
|
+
};
|
|
63
|
+
export var SystemContentBlock;
|
|
64
|
+
(function (SystemContentBlock) {
|
|
65
|
+
SystemContentBlock.visit = (value, visitor) => {
|
|
66
|
+
if (value.text !== undefined)
|
|
67
|
+
return visitor.text(value.text);
|
|
68
|
+
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
69
|
+
};
|
|
70
|
+
})(SystemContentBlock || (SystemContentBlock = {}));
|
|
71
|
+
export var ToolChoice;
|
|
72
|
+
(function (ToolChoice) {
|
|
73
|
+
ToolChoice.visit = (value, visitor) => {
|
|
74
|
+
if (value.auto !== undefined)
|
|
75
|
+
return visitor.auto(value.auto);
|
|
76
|
+
if (value.any !== undefined)
|
|
77
|
+
return visitor.any(value.any);
|
|
78
|
+
if (value.tool !== undefined)
|
|
79
|
+
return visitor.tool(value.tool);
|
|
80
|
+
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
81
|
+
};
|
|
82
|
+
})(ToolChoice || (ToolChoice = {}));
|
|
83
|
+
export var ToolInputSchema;
|
|
84
|
+
(function (ToolInputSchema) {
|
|
85
|
+
ToolInputSchema.visit = (value, visitor) => {
|
|
86
|
+
if (value.json !== undefined)
|
|
87
|
+
return visitor.json(value.json);
|
|
88
|
+
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
89
|
+
};
|
|
90
|
+
})(ToolInputSchema || (ToolInputSchema = {}));
|
|
91
|
+
export var Tool;
|
|
92
|
+
(function (Tool) {
|
|
93
|
+
Tool.visit = (value, visitor) => {
|
|
94
|
+
if (value.toolSpec !== undefined)
|
|
95
|
+
return visitor.toolSpec(value.toolSpec);
|
|
96
|
+
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
97
|
+
};
|
|
98
|
+
})(Tool || (Tool = {}));
|
|
99
|
+
export var ConverseOutput;
|
|
100
|
+
(function (ConverseOutput) {
|
|
101
|
+
ConverseOutput.visit = (value, visitor) => {
|
|
102
|
+
if (value.message !== undefined)
|
|
103
|
+
return visitor.message(value.message);
|
|
104
|
+
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
105
|
+
};
|
|
106
|
+
})(ConverseOutput || (ConverseOutput = {}));
|
|
107
|
+
export const StopReason = {
|
|
108
|
+
CONTENT_FILTERED: "content_filtered",
|
|
109
|
+
END_TURN: "end_turn",
|
|
110
|
+
MAX_TOKENS: "max_tokens",
|
|
111
|
+
STOP_SEQUENCE: "stop_sequence",
|
|
112
|
+
TOOL_USE: "tool_use",
|
|
113
|
+
};
|
|
15
114
|
export class InternalServerException extends __BaseException {
|
|
16
115
|
constructor(opts) {
|
|
17
116
|
super({
|
|
@@ -24,10 +123,6 @@ export class InternalServerException extends __BaseException {
|
|
|
24
123
|
Object.setPrototypeOf(this, InternalServerException.prototype);
|
|
25
124
|
}
|
|
26
125
|
}
|
|
27
|
-
export const Trace = {
|
|
28
|
-
DISABLED: "DISABLED",
|
|
29
|
-
ENABLED: "ENABLED",
|
|
30
|
-
};
|
|
31
126
|
export class ModelErrorException extends __BaseException {
|
|
32
127
|
constructor(opts) {
|
|
33
128
|
super({
|
|
@@ -78,18 +173,6 @@ export class ResourceNotFoundException extends __BaseException {
|
|
|
78
173
|
Object.setPrototypeOf(this, ResourceNotFoundException.prototype);
|
|
79
174
|
}
|
|
80
175
|
}
|
|
81
|
-
export class ServiceQuotaExceededException extends __BaseException {
|
|
82
|
-
constructor(opts) {
|
|
83
|
-
super({
|
|
84
|
-
name: "ServiceQuotaExceededException",
|
|
85
|
-
$fault: "client",
|
|
86
|
-
...opts,
|
|
87
|
-
});
|
|
88
|
-
this.name = "ServiceQuotaExceededException";
|
|
89
|
-
this.$fault = "client";
|
|
90
|
-
Object.setPrototypeOf(this, ServiceQuotaExceededException.prototype);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
176
|
export class ThrottlingException extends __BaseException {
|
|
94
177
|
constructor(opts) {
|
|
95
178
|
super({
|
|
@@ -114,6 +197,24 @@ export class ValidationException extends __BaseException {
|
|
|
114
197
|
Object.setPrototypeOf(this, ValidationException.prototype);
|
|
115
198
|
}
|
|
116
199
|
}
|
|
200
|
+
export var ContentBlockDelta;
|
|
201
|
+
(function (ContentBlockDelta) {
|
|
202
|
+
ContentBlockDelta.visit = (value, visitor) => {
|
|
203
|
+
if (value.text !== undefined)
|
|
204
|
+
return visitor.text(value.text);
|
|
205
|
+
if (value.toolUse !== undefined)
|
|
206
|
+
return visitor.toolUse(value.toolUse);
|
|
207
|
+
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
208
|
+
};
|
|
209
|
+
})(ContentBlockDelta || (ContentBlockDelta = {}));
|
|
210
|
+
export var ContentBlockStart;
|
|
211
|
+
(function (ContentBlockStart) {
|
|
212
|
+
ContentBlockStart.visit = (value, visitor) => {
|
|
213
|
+
if (value.toolUse !== undefined)
|
|
214
|
+
return visitor.toolUse(value.toolUse);
|
|
215
|
+
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
216
|
+
};
|
|
217
|
+
})(ContentBlockStart || (ContentBlockStart = {}));
|
|
117
218
|
export class ModelStreamErrorException extends __BaseException {
|
|
118
219
|
constructor(opts) {
|
|
119
220
|
super({
|
|
@@ -128,6 +229,48 @@ export class ModelStreamErrorException extends __BaseException {
|
|
|
128
229
|
this.originalMessage = opts.originalMessage;
|
|
129
230
|
}
|
|
130
231
|
}
|
|
232
|
+
export var ConverseStreamOutput;
|
|
233
|
+
(function (ConverseStreamOutput) {
|
|
234
|
+
ConverseStreamOutput.visit = (value, visitor) => {
|
|
235
|
+
if (value.messageStart !== undefined)
|
|
236
|
+
return visitor.messageStart(value.messageStart);
|
|
237
|
+
if (value.contentBlockStart !== undefined)
|
|
238
|
+
return visitor.contentBlockStart(value.contentBlockStart);
|
|
239
|
+
if (value.contentBlockDelta !== undefined)
|
|
240
|
+
return visitor.contentBlockDelta(value.contentBlockDelta);
|
|
241
|
+
if (value.contentBlockStop !== undefined)
|
|
242
|
+
return visitor.contentBlockStop(value.contentBlockStop);
|
|
243
|
+
if (value.messageStop !== undefined)
|
|
244
|
+
return visitor.messageStop(value.messageStop);
|
|
245
|
+
if (value.metadata !== undefined)
|
|
246
|
+
return visitor.metadata(value.metadata);
|
|
247
|
+
if (value.internalServerException !== undefined)
|
|
248
|
+
return visitor.internalServerException(value.internalServerException);
|
|
249
|
+
if (value.modelStreamErrorException !== undefined)
|
|
250
|
+
return visitor.modelStreamErrorException(value.modelStreamErrorException);
|
|
251
|
+
if (value.validationException !== undefined)
|
|
252
|
+
return visitor.validationException(value.validationException);
|
|
253
|
+
if (value.throttlingException !== undefined)
|
|
254
|
+
return visitor.throttlingException(value.throttlingException);
|
|
255
|
+
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
256
|
+
};
|
|
257
|
+
})(ConverseStreamOutput || (ConverseStreamOutput = {}));
|
|
258
|
+
export const Trace = {
|
|
259
|
+
DISABLED: "DISABLED",
|
|
260
|
+
ENABLED: "ENABLED",
|
|
261
|
+
};
|
|
262
|
+
export class ServiceQuotaExceededException extends __BaseException {
|
|
263
|
+
constructor(opts) {
|
|
264
|
+
super({
|
|
265
|
+
name: "ServiceQuotaExceededException",
|
|
266
|
+
$fault: "client",
|
|
267
|
+
...opts,
|
|
268
|
+
});
|
|
269
|
+
this.name = "ServiceQuotaExceededException";
|
|
270
|
+
this.$fault = "client";
|
|
271
|
+
Object.setPrototypeOf(this, ServiceQuotaExceededException.prototype);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
131
274
|
export var ResponseStream;
|
|
132
275
|
(function (ResponseStream) {
|
|
133
276
|
ResponseStream.visit = (value, visitor) => {
|
|
@@ -146,6 +289,34 @@ export var ResponseStream;
|
|
|
146
289
|
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
147
290
|
};
|
|
148
291
|
})(ResponseStream || (ResponseStream = {}));
|
|
292
|
+
export const ConverseStreamOutputFilterSensitiveLog = (obj) => {
|
|
293
|
+
if (obj.messageStart !== undefined)
|
|
294
|
+
return { messageStart: obj.messageStart };
|
|
295
|
+
if (obj.contentBlockStart !== undefined)
|
|
296
|
+
return { contentBlockStart: obj.contentBlockStart };
|
|
297
|
+
if (obj.contentBlockDelta !== undefined)
|
|
298
|
+
return { contentBlockDelta: obj.contentBlockDelta };
|
|
299
|
+
if (obj.contentBlockStop !== undefined)
|
|
300
|
+
return { contentBlockStop: obj.contentBlockStop };
|
|
301
|
+
if (obj.messageStop !== undefined)
|
|
302
|
+
return { messageStop: obj.messageStop };
|
|
303
|
+
if (obj.metadata !== undefined)
|
|
304
|
+
return { metadata: obj.metadata };
|
|
305
|
+
if (obj.internalServerException !== undefined)
|
|
306
|
+
return { internalServerException: obj.internalServerException };
|
|
307
|
+
if (obj.modelStreamErrorException !== undefined)
|
|
308
|
+
return { modelStreamErrorException: obj.modelStreamErrorException };
|
|
309
|
+
if (obj.validationException !== undefined)
|
|
310
|
+
return { validationException: obj.validationException };
|
|
311
|
+
if (obj.throttlingException !== undefined)
|
|
312
|
+
return { throttlingException: obj.throttlingException };
|
|
313
|
+
if (obj.$unknown !== undefined)
|
|
314
|
+
return { [obj.$unknown[0]]: "UNKNOWN" };
|
|
315
|
+
};
|
|
316
|
+
export const ConverseStreamResponseFilterSensitiveLog = (obj) => ({
|
|
317
|
+
...obj,
|
|
318
|
+
...(obj.stream && { stream: "STREAMING_CONTENT" }),
|
|
319
|
+
});
|
|
149
320
|
export const InvokeModelRequestFilterSensitiveLog = (obj) => ({
|
|
150
321
|
...obj,
|
|
151
322
|
...(obj.body && { body: SENSITIVE_STRING }),
|