@aws-sdk/client-bedrock-runtime 3.582.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.
- 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
package/dist-cjs/index.js
CHANGED
|
@@ -25,6 +25,18 @@ __export(src_exports, {
|
|
|
25
25
|
BedrockRuntime: () => BedrockRuntime,
|
|
26
26
|
BedrockRuntimeClient: () => BedrockRuntimeClient,
|
|
27
27
|
BedrockRuntimeServiceException: () => BedrockRuntimeServiceException,
|
|
28
|
+
ContentBlock: () => ContentBlock,
|
|
29
|
+
ContentBlockDelta: () => ContentBlockDelta,
|
|
30
|
+
ContentBlockStart: () => ContentBlockStart,
|
|
31
|
+
ConversationRole: () => ConversationRole,
|
|
32
|
+
ConverseCommand: () => ConverseCommand,
|
|
33
|
+
ConverseOutput: () => ConverseOutput,
|
|
34
|
+
ConverseStreamCommand: () => ConverseStreamCommand,
|
|
35
|
+
ConverseStreamOutput: () => ConverseStreamOutput,
|
|
36
|
+
ConverseStreamOutputFilterSensitiveLog: () => ConverseStreamOutputFilterSensitiveLog,
|
|
37
|
+
ConverseStreamResponseFilterSensitiveLog: () => ConverseStreamResponseFilterSensitiveLog,
|
|
38
|
+
ImageFormat: () => ImageFormat,
|
|
39
|
+
ImageSource: () => ImageSource,
|
|
28
40
|
InternalServerException: () => InternalServerException,
|
|
29
41
|
InvokeModelCommand: () => InvokeModelCommand,
|
|
30
42
|
InvokeModelRequestFilterSensitiveLog: () => InvokeModelRequestFilterSensitiveLog,
|
|
@@ -41,7 +53,14 @@ __export(src_exports, {
|
|
|
41
53
|
ResponseStream: () => ResponseStream,
|
|
42
54
|
ResponseStreamFilterSensitiveLog: () => ResponseStreamFilterSensitiveLog,
|
|
43
55
|
ServiceQuotaExceededException: () => ServiceQuotaExceededException,
|
|
56
|
+
StopReason: () => StopReason,
|
|
57
|
+
SystemContentBlock: () => SystemContentBlock,
|
|
44
58
|
ThrottlingException: () => ThrottlingException,
|
|
59
|
+
Tool: () => Tool,
|
|
60
|
+
ToolChoice: () => ToolChoice,
|
|
61
|
+
ToolInputSchema: () => ToolInputSchema,
|
|
62
|
+
ToolResultContentBlock: () => ToolResultContentBlock,
|
|
63
|
+
ToolResultStatus: () => ToolResultStatus,
|
|
45
64
|
Trace: () => Trace,
|
|
46
65
|
ValidationException: () => ValidationException,
|
|
47
66
|
__Client: () => import_smithy_client.Client
|
|
@@ -196,13 +215,15 @@ var BedrockRuntimeClient = _BedrockRuntimeClient;
|
|
|
196
215
|
// src/BedrockRuntime.ts
|
|
197
216
|
|
|
198
217
|
|
|
199
|
-
// src/commands/
|
|
218
|
+
// src/commands/ConverseCommand.ts
|
|
200
219
|
|
|
201
220
|
var import_middleware_serde = require("@smithy/middleware-serde");
|
|
202
221
|
|
|
203
222
|
var import_types = require("@smithy/types");
|
|
204
223
|
|
|
205
|
-
// src/
|
|
224
|
+
// src/protocols/Aws_restJson1.ts
|
|
225
|
+
var import_core2 = require("@aws-sdk/core");
|
|
226
|
+
|
|
206
227
|
|
|
207
228
|
|
|
208
229
|
// src/models/BedrockRuntimeServiceException.ts
|
|
@@ -220,6 +241,7 @@ __name(_BedrockRuntimeServiceException, "BedrockRuntimeServiceException");
|
|
|
220
241
|
var BedrockRuntimeServiceException = _BedrockRuntimeServiceException;
|
|
221
242
|
|
|
222
243
|
// src/models/models_0.ts
|
|
244
|
+
|
|
223
245
|
var _AccessDeniedException = class _AccessDeniedException extends BedrockRuntimeServiceException {
|
|
224
246
|
/**
|
|
225
247
|
* @internal
|
|
@@ -237,6 +259,105 @@ var _AccessDeniedException = class _AccessDeniedException extends BedrockRuntime
|
|
|
237
259
|
};
|
|
238
260
|
__name(_AccessDeniedException, "AccessDeniedException");
|
|
239
261
|
var AccessDeniedException = _AccessDeniedException;
|
|
262
|
+
var ImageFormat = {
|
|
263
|
+
GIF: "gif",
|
|
264
|
+
JPEG: "jpeg",
|
|
265
|
+
PNG: "png",
|
|
266
|
+
WEBP: "webp"
|
|
267
|
+
};
|
|
268
|
+
var ImageSource;
|
|
269
|
+
((ImageSource2) => {
|
|
270
|
+
ImageSource2.visit = /* @__PURE__ */ __name((value, visitor) => {
|
|
271
|
+
if (value.bytes !== void 0)
|
|
272
|
+
return visitor.bytes(value.bytes);
|
|
273
|
+
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
274
|
+
}, "visit");
|
|
275
|
+
})(ImageSource || (ImageSource = {}));
|
|
276
|
+
var ToolResultContentBlock;
|
|
277
|
+
((ToolResultContentBlock2) => {
|
|
278
|
+
ToolResultContentBlock2.visit = /* @__PURE__ */ __name((value, visitor) => {
|
|
279
|
+
if (value.json !== void 0)
|
|
280
|
+
return visitor.json(value.json);
|
|
281
|
+
if (value.text !== void 0)
|
|
282
|
+
return visitor.text(value.text);
|
|
283
|
+
if (value.image !== void 0)
|
|
284
|
+
return visitor.image(value.image);
|
|
285
|
+
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
286
|
+
}, "visit");
|
|
287
|
+
})(ToolResultContentBlock || (ToolResultContentBlock = {}));
|
|
288
|
+
var ToolResultStatus = {
|
|
289
|
+
ERROR: "error",
|
|
290
|
+
SUCCESS: "success"
|
|
291
|
+
};
|
|
292
|
+
var ContentBlock;
|
|
293
|
+
((ContentBlock2) => {
|
|
294
|
+
ContentBlock2.visit = /* @__PURE__ */ __name((value, visitor) => {
|
|
295
|
+
if (value.text !== void 0)
|
|
296
|
+
return visitor.text(value.text);
|
|
297
|
+
if (value.image !== void 0)
|
|
298
|
+
return visitor.image(value.image);
|
|
299
|
+
if (value.toolUse !== void 0)
|
|
300
|
+
return visitor.toolUse(value.toolUse);
|
|
301
|
+
if (value.toolResult !== void 0)
|
|
302
|
+
return visitor.toolResult(value.toolResult);
|
|
303
|
+
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
304
|
+
}, "visit");
|
|
305
|
+
})(ContentBlock || (ContentBlock = {}));
|
|
306
|
+
var ConversationRole = {
|
|
307
|
+
ASSISTANT: "assistant",
|
|
308
|
+
USER: "user"
|
|
309
|
+
};
|
|
310
|
+
var SystemContentBlock;
|
|
311
|
+
((SystemContentBlock3) => {
|
|
312
|
+
SystemContentBlock3.visit = /* @__PURE__ */ __name((value, visitor) => {
|
|
313
|
+
if (value.text !== void 0)
|
|
314
|
+
return visitor.text(value.text);
|
|
315
|
+
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
316
|
+
}, "visit");
|
|
317
|
+
})(SystemContentBlock || (SystemContentBlock = {}));
|
|
318
|
+
var ToolChoice;
|
|
319
|
+
((ToolChoice3) => {
|
|
320
|
+
ToolChoice3.visit = /* @__PURE__ */ __name((value, visitor) => {
|
|
321
|
+
if (value.auto !== void 0)
|
|
322
|
+
return visitor.auto(value.auto);
|
|
323
|
+
if (value.any !== void 0)
|
|
324
|
+
return visitor.any(value.any);
|
|
325
|
+
if (value.tool !== void 0)
|
|
326
|
+
return visitor.tool(value.tool);
|
|
327
|
+
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
328
|
+
}, "visit");
|
|
329
|
+
})(ToolChoice || (ToolChoice = {}));
|
|
330
|
+
var ToolInputSchema;
|
|
331
|
+
((ToolInputSchema2) => {
|
|
332
|
+
ToolInputSchema2.visit = /* @__PURE__ */ __name((value, visitor) => {
|
|
333
|
+
if (value.json !== void 0)
|
|
334
|
+
return visitor.json(value.json);
|
|
335
|
+
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
336
|
+
}, "visit");
|
|
337
|
+
})(ToolInputSchema || (ToolInputSchema = {}));
|
|
338
|
+
var Tool;
|
|
339
|
+
((Tool2) => {
|
|
340
|
+
Tool2.visit = /* @__PURE__ */ __name((value, visitor) => {
|
|
341
|
+
if (value.toolSpec !== void 0)
|
|
342
|
+
return visitor.toolSpec(value.toolSpec);
|
|
343
|
+
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
344
|
+
}, "visit");
|
|
345
|
+
})(Tool || (Tool = {}));
|
|
346
|
+
var ConverseOutput;
|
|
347
|
+
((ConverseOutput3) => {
|
|
348
|
+
ConverseOutput3.visit = /* @__PURE__ */ __name((value, visitor) => {
|
|
349
|
+
if (value.message !== void 0)
|
|
350
|
+
return visitor.message(value.message);
|
|
351
|
+
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
352
|
+
}, "visit");
|
|
353
|
+
})(ConverseOutput || (ConverseOutput = {}));
|
|
354
|
+
var StopReason = {
|
|
355
|
+
CONTENT_FILTERED: "content_filtered",
|
|
356
|
+
END_TURN: "end_turn",
|
|
357
|
+
MAX_TOKENS: "max_tokens",
|
|
358
|
+
STOP_SEQUENCE: "stop_sequence",
|
|
359
|
+
TOOL_USE: "tool_use"
|
|
360
|
+
};
|
|
240
361
|
var _InternalServerException = class _InternalServerException extends BedrockRuntimeServiceException {
|
|
241
362
|
/**
|
|
242
363
|
* @internal
|
|
@@ -254,10 +375,6 @@ var _InternalServerException = class _InternalServerException extends BedrockRun
|
|
|
254
375
|
};
|
|
255
376
|
__name(_InternalServerException, "InternalServerException");
|
|
256
377
|
var InternalServerException = _InternalServerException;
|
|
257
|
-
var Trace = {
|
|
258
|
-
DISABLED: "DISABLED",
|
|
259
|
-
ENABLED: "ENABLED"
|
|
260
|
-
};
|
|
261
378
|
var _ModelErrorException = class _ModelErrorException extends BedrockRuntimeServiceException {
|
|
262
379
|
/**
|
|
263
380
|
* @internal
|
|
@@ -328,23 +445,6 @@ var _ResourceNotFoundException = class _ResourceNotFoundException extends Bedroc
|
|
|
328
445
|
};
|
|
329
446
|
__name(_ResourceNotFoundException, "ResourceNotFoundException");
|
|
330
447
|
var ResourceNotFoundException = _ResourceNotFoundException;
|
|
331
|
-
var _ServiceQuotaExceededException = class _ServiceQuotaExceededException extends BedrockRuntimeServiceException {
|
|
332
|
-
/**
|
|
333
|
-
* @internal
|
|
334
|
-
*/
|
|
335
|
-
constructor(opts) {
|
|
336
|
-
super({
|
|
337
|
-
name: "ServiceQuotaExceededException",
|
|
338
|
-
$fault: "client",
|
|
339
|
-
...opts
|
|
340
|
-
});
|
|
341
|
-
this.name = "ServiceQuotaExceededException";
|
|
342
|
-
this.$fault = "client";
|
|
343
|
-
Object.setPrototypeOf(this, _ServiceQuotaExceededException.prototype);
|
|
344
|
-
}
|
|
345
|
-
};
|
|
346
|
-
__name(_ServiceQuotaExceededException, "ServiceQuotaExceededException");
|
|
347
|
-
var ServiceQuotaExceededException = _ServiceQuotaExceededException;
|
|
348
448
|
var _ThrottlingException = class _ThrottlingException extends BedrockRuntimeServiceException {
|
|
349
449
|
/**
|
|
350
450
|
* @internal
|
|
@@ -379,6 +479,24 @@ var _ValidationException = class _ValidationException extends BedrockRuntimeServ
|
|
|
379
479
|
};
|
|
380
480
|
__name(_ValidationException, "ValidationException");
|
|
381
481
|
var ValidationException = _ValidationException;
|
|
482
|
+
var ContentBlockDelta;
|
|
483
|
+
((ContentBlockDelta2) => {
|
|
484
|
+
ContentBlockDelta2.visit = /* @__PURE__ */ __name((value, visitor) => {
|
|
485
|
+
if (value.text !== void 0)
|
|
486
|
+
return visitor.text(value.text);
|
|
487
|
+
if (value.toolUse !== void 0)
|
|
488
|
+
return visitor.toolUse(value.toolUse);
|
|
489
|
+
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
490
|
+
}, "visit");
|
|
491
|
+
})(ContentBlockDelta || (ContentBlockDelta = {}));
|
|
492
|
+
var ContentBlockStart;
|
|
493
|
+
((ContentBlockStart2) => {
|
|
494
|
+
ContentBlockStart2.visit = /* @__PURE__ */ __name((value, visitor) => {
|
|
495
|
+
if (value.toolUse !== void 0)
|
|
496
|
+
return visitor.toolUse(value.toolUse);
|
|
497
|
+
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
498
|
+
}, "visit");
|
|
499
|
+
})(ContentBlockStart || (ContentBlockStart = {}));
|
|
382
500
|
var _ModelStreamErrorException = class _ModelStreamErrorException extends BedrockRuntimeServiceException {
|
|
383
501
|
/**
|
|
384
502
|
* @internal
|
|
@@ -398,6 +516,53 @@ var _ModelStreamErrorException = class _ModelStreamErrorException extends Bedroc
|
|
|
398
516
|
};
|
|
399
517
|
__name(_ModelStreamErrorException, "ModelStreamErrorException");
|
|
400
518
|
var ModelStreamErrorException = _ModelStreamErrorException;
|
|
519
|
+
var ConverseStreamOutput;
|
|
520
|
+
((ConverseStreamOutput3) => {
|
|
521
|
+
ConverseStreamOutput3.visit = /* @__PURE__ */ __name((value, visitor) => {
|
|
522
|
+
if (value.messageStart !== void 0)
|
|
523
|
+
return visitor.messageStart(value.messageStart);
|
|
524
|
+
if (value.contentBlockStart !== void 0)
|
|
525
|
+
return visitor.contentBlockStart(value.contentBlockStart);
|
|
526
|
+
if (value.contentBlockDelta !== void 0)
|
|
527
|
+
return visitor.contentBlockDelta(value.contentBlockDelta);
|
|
528
|
+
if (value.contentBlockStop !== void 0)
|
|
529
|
+
return visitor.contentBlockStop(value.contentBlockStop);
|
|
530
|
+
if (value.messageStop !== void 0)
|
|
531
|
+
return visitor.messageStop(value.messageStop);
|
|
532
|
+
if (value.metadata !== void 0)
|
|
533
|
+
return visitor.metadata(value.metadata);
|
|
534
|
+
if (value.internalServerException !== void 0)
|
|
535
|
+
return visitor.internalServerException(value.internalServerException);
|
|
536
|
+
if (value.modelStreamErrorException !== void 0)
|
|
537
|
+
return visitor.modelStreamErrorException(value.modelStreamErrorException);
|
|
538
|
+
if (value.validationException !== void 0)
|
|
539
|
+
return visitor.validationException(value.validationException);
|
|
540
|
+
if (value.throttlingException !== void 0)
|
|
541
|
+
return visitor.throttlingException(value.throttlingException);
|
|
542
|
+
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
543
|
+
}, "visit");
|
|
544
|
+
})(ConverseStreamOutput || (ConverseStreamOutput = {}));
|
|
545
|
+
var Trace = {
|
|
546
|
+
DISABLED: "DISABLED",
|
|
547
|
+
ENABLED: "ENABLED"
|
|
548
|
+
};
|
|
549
|
+
var _ServiceQuotaExceededException = class _ServiceQuotaExceededException extends BedrockRuntimeServiceException {
|
|
550
|
+
/**
|
|
551
|
+
* @internal
|
|
552
|
+
*/
|
|
553
|
+
constructor(opts) {
|
|
554
|
+
super({
|
|
555
|
+
name: "ServiceQuotaExceededException",
|
|
556
|
+
$fault: "client",
|
|
557
|
+
...opts
|
|
558
|
+
});
|
|
559
|
+
this.name = "ServiceQuotaExceededException";
|
|
560
|
+
this.$fault = "client";
|
|
561
|
+
Object.setPrototypeOf(this, _ServiceQuotaExceededException.prototype);
|
|
562
|
+
}
|
|
563
|
+
};
|
|
564
|
+
__name(_ServiceQuotaExceededException, "ServiceQuotaExceededException");
|
|
565
|
+
var ServiceQuotaExceededException = _ServiceQuotaExceededException;
|
|
401
566
|
var ResponseStream;
|
|
402
567
|
((ResponseStream3) => {
|
|
403
568
|
ResponseStream3.visit = /* @__PURE__ */ __name((value, visitor) => {
|
|
@@ -416,6 +581,34 @@ var ResponseStream;
|
|
|
416
581
|
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
417
582
|
}, "visit");
|
|
418
583
|
})(ResponseStream || (ResponseStream = {}));
|
|
584
|
+
var ConverseStreamOutputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => {
|
|
585
|
+
if (obj.messageStart !== void 0)
|
|
586
|
+
return { messageStart: obj.messageStart };
|
|
587
|
+
if (obj.contentBlockStart !== void 0)
|
|
588
|
+
return { contentBlockStart: obj.contentBlockStart };
|
|
589
|
+
if (obj.contentBlockDelta !== void 0)
|
|
590
|
+
return { contentBlockDelta: obj.contentBlockDelta };
|
|
591
|
+
if (obj.contentBlockStop !== void 0)
|
|
592
|
+
return { contentBlockStop: obj.contentBlockStop };
|
|
593
|
+
if (obj.messageStop !== void 0)
|
|
594
|
+
return { messageStop: obj.messageStop };
|
|
595
|
+
if (obj.metadata !== void 0)
|
|
596
|
+
return { metadata: obj.metadata };
|
|
597
|
+
if (obj.internalServerException !== void 0)
|
|
598
|
+
return { internalServerException: obj.internalServerException };
|
|
599
|
+
if (obj.modelStreamErrorException !== void 0)
|
|
600
|
+
return { modelStreamErrorException: obj.modelStreamErrorException };
|
|
601
|
+
if (obj.validationException !== void 0)
|
|
602
|
+
return { validationException: obj.validationException };
|
|
603
|
+
if (obj.throttlingException !== void 0)
|
|
604
|
+
return { throttlingException: obj.throttlingException };
|
|
605
|
+
if (obj.$unknown !== void 0)
|
|
606
|
+
return { [obj.$unknown[0]]: "UNKNOWN" };
|
|
607
|
+
}, "ConverseStreamOutputFilterSensitiveLog");
|
|
608
|
+
var ConverseStreamResponseFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({
|
|
609
|
+
...obj,
|
|
610
|
+
...obj.stream && { stream: "STREAMING_CONTENT" }
|
|
611
|
+
}), "ConverseStreamResponseFilterSensitiveLog");
|
|
419
612
|
var InvokeModelRequestFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({
|
|
420
613
|
...obj,
|
|
421
614
|
...obj.body && { body: import_smithy_client.SENSITIVE_STRING }
|
|
@@ -454,9 +647,48 @@ var InvokeModelWithResponseStreamResponseFilterSensitiveLog = /* @__PURE__ */ __
|
|
|
454
647
|
}), "InvokeModelWithResponseStreamResponseFilterSensitiveLog");
|
|
455
648
|
|
|
456
649
|
// src/protocols/Aws_restJson1.ts
|
|
457
|
-
var
|
|
458
|
-
|
|
459
|
-
|
|
650
|
+
var se_ConverseCommand = /* @__PURE__ */ __name(async (input, context) => {
|
|
651
|
+
const b = (0, import_core.requestBuilder)(input, context);
|
|
652
|
+
const headers = {
|
|
653
|
+
"content-type": "application/json"
|
|
654
|
+
};
|
|
655
|
+
b.bp("/model/{modelId}/converse");
|
|
656
|
+
b.p("modelId", () => input.modelId, "{modelId}", false);
|
|
657
|
+
let body;
|
|
658
|
+
body = JSON.stringify(
|
|
659
|
+
(0, import_smithy_client.take)(input, {
|
|
660
|
+
additionalModelRequestFields: (_) => se_Document(_, context),
|
|
661
|
+
additionalModelResponseFieldPaths: (_) => (0, import_smithy_client._json)(_),
|
|
662
|
+
inferenceConfig: (_) => se_InferenceConfiguration(_, context),
|
|
663
|
+
messages: (_) => se_Messages(_, context),
|
|
664
|
+
system: (_) => (0, import_smithy_client._json)(_),
|
|
665
|
+
toolConfig: (_) => se_ToolConfiguration(_, context)
|
|
666
|
+
})
|
|
667
|
+
);
|
|
668
|
+
b.m("POST").h(headers).b(body);
|
|
669
|
+
return b.build();
|
|
670
|
+
}, "se_ConverseCommand");
|
|
671
|
+
var se_ConverseStreamCommand = /* @__PURE__ */ __name(async (input, context) => {
|
|
672
|
+
const b = (0, import_core.requestBuilder)(input, context);
|
|
673
|
+
const headers = {
|
|
674
|
+
"content-type": "application/json"
|
|
675
|
+
};
|
|
676
|
+
b.bp("/model/{modelId}/converse-stream");
|
|
677
|
+
b.p("modelId", () => input.modelId, "{modelId}", false);
|
|
678
|
+
let body;
|
|
679
|
+
body = JSON.stringify(
|
|
680
|
+
(0, import_smithy_client.take)(input, {
|
|
681
|
+
additionalModelRequestFields: (_) => se_Document(_, context),
|
|
682
|
+
additionalModelResponseFieldPaths: (_) => (0, import_smithy_client._json)(_),
|
|
683
|
+
inferenceConfig: (_) => se_InferenceConfiguration(_, context),
|
|
684
|
+
messages: (_) => se_Messages(_, context),
|
|
685
|
+
system: (_) => (0, import_smithy_client._json)(_),
|
|
686
|
+
toolConfig: (_) => se_ToolConfiguration(_, context)
|
|
687
|
+
})
|
|
688
|
+
);
|
|
689
|
+
b.m("POST").h(headers).b(body);
|
|
690
|
+
return b.build();
|
|
691
|
+
}, "se_ConverseStreamCommand");
|
|
460
692
|
var se_InvokeModelCommand = /* @__PURE__ */ __name(async (input, context) => {
|
|
461
693
|
const b = (0, import_core.requestBuilder)(input, context);
|
|
462
694
|
const headers = (0, import_smithy_client.map)({}, isSerializableHeaderValue, {
|
|
@@ -493,6 +725,35 @@ var se_InvokeModelWithResponseStreamCommand = /* @__PURE__ */ __name(async (inpu
|
|
|
493
725
|
b.m("POST").h(headers).b(body);
|
|
494
726
|
return b.build();
|
|
495
727
|
}, "se_InvokeModelWithResponseStreamCommand");
|
|
728
|
+
var de_ConverseCommand = /* @__PURE__ */ __name(async (output, context) => {
|
|
729
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
730
|
+
return de_CommandError(output, context);
|
|
731
|
+
}
|
|
732
|
+
const contents = (0, import_smithy_client.map)({
|
|
733
|
+
$metadata: deserializeMetadata(output)
|
|
734
|
+
});
|
|
735
|
+
const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
|
|
736
|
+
const doc = (0, import_smithy_client.take)(data, {
|
|
737
|
+
additionalModelResponseFields: (_) => de_Document(_, context),
|
|
738
|
+
metrics: import_smithy_client._json,
|
|
739
|
+
output: (_) => de_ConverseOutput((0, import_core2.awsExpectUnion)(_), context),
|
|
740
|
+
stopReason: import_smithy_client.expectString,
|
|
741
|
+
usage: import_smithy_client._json
|
|
742
|
+
});
|
|
743
|
+
Object.assign(contents, doc);
|
|
744
|
+
return contents;
|
|
745
|
+
}, "de_ConverseCommand");
|
|
746
|
+
var de_ConverseStreamCommand = /* @__PURE__ */ __name(async (output, context) => {
|
|
747
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
748
|
+
return de_CommandError(output, context);
|
|
749
|
+
}
|
|
750
|
+
const contents = (0, import_smithy_client.map)({
|
|
751
|
+
$metadata: deserializeMetadata(output)
|
|
752
|
+
});
|
|
753
|
+
const data = output.body;
|
|
754
|
+
contents.stream = de_ConverseStreamOutput(data, context);
|
|
755
|
+
return contents;
|
|
756
|
+
}, "de_ConverseStreamCommand");
|
|
496
757
|
var de_InvokeModelCommand = /* @__PURE__ */ __name(async (output, context) => {
|
|
497
758
|
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
498
759
|
return de_CommandError(output, context);
|
|
@@ -542,15 +803,15 @@ var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
|
|
|
542
803
|
case "ResourceNotFoundException":
|
|
543
804
|
case "com.amazonaws.bedrockruntime#ResourceNotFoundException":
|
|
544
805
|
throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
|
|
545
|
-
case "ServiceQuotaExceededException":
|
|
546
|
-
case "com.amazonaws.bedrockruntime#ServiceQuotaExceededException":
|
|
547
|
-
throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context);
|
|
548
806
|
case "ThrottlingException":
|
|
549
807
|
case "com.amazonaws.bedrockruntime#ThrottlingException":
|
|
550
808
|
throw await de_ThrottlingExceptionRes(parsedOutput, context);
|
|
551
809
|
case "ValidationException":
|
|
552
810
|
case "com.amazonaws.bedrockruntime#ValidationException":
|
|
553
811
|
throw await de_ValidationExceptionRes(parsedOutput, context);
|
|
812
|
+
case "ServiceQuotaExceededException":
|
|
813
|
+
case "com.amazonaws.bedrockruntime#ServiceQuotaExceededException":
|
|
814
|
+
throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context);
|
|
554
815
|
case "ModelStreamErrorException":
|
|
555
816
|
case "com.amazonaws.bedrockruntime#ModelStreamErrorException":
|
|
556
817
|
throw await de_ModelStreamErrorExceptionRes(parsedOutput, context);
|
|
@@ -698,6 +959,64 @@ var de_ValidationExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, cont
|
|
|
698
959
|
});
|
|
699
960
|
return (0, import_smithy_client.decorateServiceException)(exception, parsedOutput.body);
|
|
700
961
|
}, "de_ValidationExceptionRes");
|
|
962
|
+
var de_ConverseStreamOutput = /* @__PURE__ */ __name((output, context) => {
|
|
963
|
+
return context.eventStreamMarshaller.deserialize(output, async (event) => {
|
|
964
|
+
if (event["messageStart"] != null) {
|
|
965
|
+
return {
|
|
966
|
+
messageStart: await de_MessageStartEvent_event(event["messageStart"], context)
|
|
967
|
+
};
|
|
968
|
+
}
|
|
969
|
+
if (event["contentBlockStart"] != null) {
|
|
970
|
+
return {
|
|
971
|
+
contentBlockStart: await de_ContentBlockStartEvent_event(event["contentBlockStart"], context)
|
|
972
|
+
};
|
|
973
|
+
}
|
|
974
|
+
if (event["contentBlockDelta"] != null) {
|
|
975
|
+
return {
|
|
976
|
+
contentBlockDelta: await de_ContentBlockDeltaEvent_event(event["contentBlockDelta"], context)
|
|
977
|
+
};
|
|
978
|
+
}
|
|
979
|
+
if (event["contentBlockStop"] != null) {
|
|
980
|
+
return {
|
|
981
|
+
contentBlockStop: await de_ContentBlockStopEvent_event(event["contentBlockStop"], context)
|
|
982
|
+
};
|
|
983
|
+
}
|
|
984
|
+
if (event["messageStop"] != null) {
|
|
985
|
+
return {
|
|
986
|
+
messageStop: await de_MessageStopEvent_event(event["messageStop"], context)
|
|
987
|
+
};
|
|
988
|
+
}
|
|
989
|
+
if (event["metadata"] != null) {
|
|
990
|
+
return {
|
|
991
|
+
metadata: await de_ConverseStreamMetadataEvent_event(event["metadata"], context)
|
|
992
|
+
};
|
|
993
|
+
}
|
|
994
|
+
if (event["internalServerException"] != null) {
|
|
995
|
+
return {
|
|
996
|
+
internalServerException: await de_InternalServerException_event(event["internalServerException"], context)
|
|
997
|
+
};
|
|
998
|
+
}
|
|
999
|
+
if (event["modelStreamErrorException"] != null) {
|
|
1000
|
+
return {
|
|
1001
|
+
modelStreamErrorException: await de_ModelStreamErrorException_event(
|
|
1002
|
+
event["modelStreamErrorException"],
|
|
1003
|
+
context
|
|
1004
|
+
)
|
|
1005
|
+
};
|
|
1006
|
+
}
|
|
1007
|
+
if (event["validationException"] != null) {
|
|
1008
|
+
return {
|
|
1009
|
+
validationException: await de_ValidationException_event(event["validationException"], context)
|
|
1010
|
+
};
|
|
1011
|
+
}
|
|
1012
|
+
if (event["throttlingException"] != null) {
|
|
1013
|
+
return {
|
|
1014
|
+
throttlingException: await de_ThrottlingException_event(event["throttlingException"], context)
|
|
1015
|
+
};
|
|
1016
|
+
}
|
|
1017
|
+
return { $unknown: output };
|
|
1018
|
+
});
|
|
1019
|
+
}, "de_ConverseStreamOutput");
|
|
701
1020
|
var de_ResponseStream = /* @__PURE__ */ __name((output, context) => {
|
|
702
1021
|
return context.eventStreamMarshaller.deserialize(output, async (event) => {
|
|
703
1022
|
if (event["chunk"] != null) {
|
|
@@ -736,6 +1055,30 @@ var de_ResponseStream = /* @__PURE__ */ __name((output, context) => {
|
|
|
736
1055
|
return { $unknown: output };
|
|
737
1056
|
});
|
|
738
1057
|
}, "de_ResponseStream");
|
|
1058
|
+
var de_ContentBlockDeltaEvent_event = /* @__PURE__ */ __name(async (output, context) => {
|
|
1059
|
+
const contents = {};
|
|
1060
|
+
const data = await (0, import_core2.parseJsonBody)(output.body, context);
|
|
1061
|
+
Object.assign(contents, (0, import_smithy_client._json)(data));
|
|
1062
|
+
return contents;
|
|
1063
|
+
}, "de_ContentBlockDeltaEvent_event");
|
|
1064
|
+
var de_ContentBlockStartEvent_event = /* @__PURE__ */ __name(async (output, context) => {
|
|
1065
|
+
const contents = {};
|
|
1066
|
+
const data = await (0, import_core2.parseJsonBody)(output.body, context);
|
|
1067
|
+
Object.assign(contents, (0, import_smithy_client._json)(data));
|
|
1068
|
+
return contents;
|
|
1069
|
+
}, "de_ContentBlockStartEvent_event");
|
|
1070
|
+
var de_ContentBlockStopEvent_event = /* @__PURE__ */ __name(async (output, context) => {
|
|
1071
|
+
const contents = {};
|
|
1072
|
+
const data = await (0, import_core2.parseJsonBody)(output.body, context);
|
|
1073
|
+
Object.assign(contents, (0, import_smithy_client._json)(data));
|
|
1074
|
+
return contents;
|
|
1075
|
+
}, "de_ContentBlockStopEvent_event");
|
|
1076
|
+
var de_ConverseStreamMetadataEvent_event = /* @__PURE__ */ __name(async (output, context) => {
|
|
1077
|
+
const contents = {};
|
|
1078
|
+
const data = await (0, import_core2.parseJsonBody)(output.body, context);
|
|
1079
|
+
Object.assign(contents, (0, import_smithy_client._json)(data));
|
|
1080
|
+
return contents;
|
|
1081
|
+
}, "de_ConverseStreamMetadataEvent_event");
|
|
739
1082
|
var de_InternalServerException_event = /* @__PURE__ */ __name(async (output, context) => {
|
|
740
1083
|
const parsedOutput = {
|
|
741
1084
|
...output,
|
|
@@ -743,6 +1086,18 @@ var de_InternalServerException_event = /* @__PURE__ */ __name(async (output, con
|
|
|
743
1086
|
};
|
|
744
1087
|
return de_InternalServerExceptionRes(parsedOutput, context);
|
|
745
1088
|
}, "de_InternalServerException_event");
|
|
1089
|
+
var de_MessageStartEvent_event = /* @__PURE__ */ __name(async (output, context) => {
|
|
1090
|
+
const contents = {};
|
|
1091
|
+
const data = await (0, import_core2.parseJsonBody)(output.body, context);
|
|
1092
|
+
Object.assign(contents, (0, import_smithy_client._json)(data));
|
|
1093
|
+
return contents;
|
|
1094
|
+
}, "de_MessageStartEvent_event");
|
|
1095
|
+
var de_MessageStopEvent_event = /* @__PURE__ */ __name(async (output, context) => {
|
|
1096
|
+
const contents = {};
|
|
1097
|
+
const data = await (0, import_core2.parseJsonBody)(output.body, context);
|
|
1098
|
+
Object.assign(contents, de_MessageStopEvent(data, context));
|
|
1099
|
+
return contents;
|
|
1100
|
+
}, "de_MessageStopEvent_event");
|
|
746
1101
|
var de_ModelStreamErrorException_event = /* @__PURE__ */ __name(async (output, context) => {
|
|
747
1102
|
const parsedOutput = {
|
|
748
1103
|
...output,
|
|
@@ -777,11 +1132,216 @@ var de_ValidationException_event = /* @__PURE__ */ __name(async (output, context
|
|
|
777
1132
|
};
|
|
778
1133
|
return de_ValidationExceptionRes(parsedOutput, context);
|
|
779
1134
|
}, "de_ValidationException_event");
|
|
1135
|
+
var se_ContentBlock = /* @__PURE__ */ __name((input, context) => {
|
|
1136
|
+
return ContentBlock.visit(input, {
|
|
1137
|
+
image: (value) => ({ image: se_ImageBlock(value, context) }),
|
|
1138
|
+
text: (value) => ({ text: value }),
|
|
1139
|
+
toolResult: (value) => ({ toolResult: se_ToolResultBlock(value, context) }),
|
|
1140
|
+
toolUse: (value) => ({ toolUse: se_ToolUseBlock(value, context) }),
|
|
1141
|
+
_: (name, value) => ({ name: value })
|
|
1142
|
+
});
|
|
1143
|
+
}, "se_ContentBlock");
|
|
1144
|
+
var se_ContentBlocks = /* @__PURE__ */ __name((input, context) => {
|
|
1145
|
+
return input.filter((e) => e != null).map((entry) => {
|
|
1146
|
+
return se_ContentBlock(entry, context);
|
|
1147
|
+
});
|
|
1148
|
+
}, "se_ContentBlocks");
|
|
1149
|
+
var se_ImageBlock = /* @__PURE__ */ __name((input, context) => {
|
|
1150
|
+
return (0, import_smithy_client.take)(input, {
|
|
1151
|
+
format: [],
|
|
1152
|
+
source: (_) => se_ImageSource(_, context)
|
|
1153
|
+
});
|
|
1154
|
+
}, "se_ImageBlock");
|
|
1155
|
+
var se_ImageSource = /* @__PURE__ */ __name((input, context) => {
|
|
1156
|
+
return ImageSource.visit(input, {
|
|
1157
|
+
bytes: (value) => ({ bytes: context.base64Encoder(value) }),
|
|
1158
|
+
_: (name, value) => ({ name: value })
|
|
1159
|
+
});
|
|
1160
|
+
}, "se_ImageSource");
|
|
1161
|
+
var se_InferenceConfiguration = /* @__PURE__ */ __name((input, context) => {
|
|
1162
|
+
return (0, import_smithy_client.take)(input, {
|
|
1163
|
+
maxTokens: [],
|
|
1164
|
+
stopSequences: import_smithy_client._json,
|
|
1165
|
+
temperature: import_smithy_client.serializeFloat,
|
|
1166
|
+
topP: import_smithy_client.serializeFloat
|
|
1167
|
+
});
|
|
1168
|
+
}, "se_InferenceConfiguration");
|
|
1169
|
+
var se_Message = /* @__PURE__ */ __name((input, context) => {
|
|
1170
|
+
return (0, import_smithy_client.take)(input, {
|
|
1171
|
+
content: (_) => se_ContentBlocks(_, context),
|
|
1172
|
+
role: []
|
|
1173
|
+
});
|
|
1174
|
+
}, "se_Message");
|
|
1175
|
+
var se_Messages = /* @__PURE__ */ __name((input, context) => {
|
|
1176
|
+
return input.filter((e) => e != null).map((entry) => {
|
|
1177
|
+
return se_Message(entry, context);
|
|
1178
|
+
});
|
|
1179
|
+
}, "se_Messages");
|
|
1180
|
+
var se_Tool = /* @__PURE__ */ __name((input, context) => {
|
|
1181
|
+
return Tool.visit(input, {
|
|
1182
|
+
toolSpec: (value) => ({ toolSpec: se_ToolSpecification(value, context) }),
|
|
1183
|
+
_: (name, value) => ({ name: value })
|
|
1184
|
+
});
|
|
1185
|
+
}, "se_Tool");
|
|
1186
|
+
var se_ToolConfiguration = /* @__PURE__ */ __name((input, context) => {
|
|
1187
|
+
return (0, import_smithy_client.take)(input, {
|
|
1188
|
+
toolChoice: import_smithy_client._json,
|
|
1189
|
+
tools: (_) => se_Tools(_, context)
|
|
1190
|
+
});
|
|
1191
|
+
}, "se_ToolConfiguration");
|
|
1192
|
+
var se_ToolInputSchema = /* @__PURE__ */ __name((input, context) => {
|
|
1193
|
+
return ToolInputSchema.visit(input, {
|
|
1194
|
+
json: (value) => ({ json: se_Document(value, context) }),
|
|
1195
|
+
_: (name, value) => ({ name: value })
|
|
1196
|
+
});
|
|
1197
|
+
}, "se_ToolInputSchema");
|
|
1198
|
+
var se_ToolResultBlock = /* @__PURE__ */ __name((input, context) => {
|
|
1199
|
+
return (0, import_smithy_client.take)(input, {
|
|
1200
|
+
content: (_) => se_ToolResultContentBlocks(_, context),
|
|
1201
|
+
status: [],
|
|
1202
|
+
toolUseId: []
|
|
1203
|
+
});
|
|
1204
|
+
}, "se_ToolResultBlock");
|
|
1205
|
+
var se_ToolResultContentBlock = /* @__PURE__ */ __name((input, context) => {
|
|
1206
|
+
return ToolResultContentBlock.visit(input, {
|
|
1207
|
+
image: (value) => ({ image: se_ImageBlock(value, context) }),
|
|
1208
|
+
json: (value) => ({ json: se_Document(value, context) }),
|
|
1209
|
+
text: (value) => ({ text: value }),
|
|
1210
|
+
_: (name, value) => ({ name: value })
|
|
1211
|
+
});
|
|
1212
|
+
}, "se_ToolResultContentBlock");
|
|
1213
|
+
var se_ToolResultContentBlocks = /* @__PURE__ */ __name((input, context) => {
|
|
1214
|
+
return input.filter((e) => e != null).map((entry) => {
|
|
1215
|
+
return se_ToolResultContentBlock(entry, context);
|
|
1216
|
+
});
|
|
1217
|
+
}, "se_ToolResultContentBlocks");
|
|
1218
|
+
var se_Tools = /* @__PURE__ */ __name((input, context) => {
|
|
1219
|
+
return input.filter((e) => e != null).map((entry) => {
|
|
1220
|
+
return se_Tool(entry, context);
|
|
1221
|
+
});
|
|
1222
|
+
}, "se_Tools");
|
|
1223
|
+
var se_ToolSpecification = /* @__PURE__ */ __name((input, context) => {
|
|
1224
|
+
return (0, import_smithy_client.take)(input, {
|
|
1225
|
+
description: [],
|
|
1226
|
+
inputSchema: (_) => se_ToolInputSchema(_, context),
|
|
1227
|
+
name: []
|
|
1228
|
+
});
|
|
1229
|
+
}, "se_ToolSpecification");
|
|
1230
|
+
var se_ToolUseBlock = /* @__PURE__ */ __name((input, context) => {
|
|
1231
|
+
return (0, import_smithy_client.take)(input, {
|
|
1232
|
+
input: (_) => se_Document(_, context),
|
|
1233
|
+
name: [],
|
|
1234
|
+
toolUseId: []
|
|
1235
|
+
});
|
|
1236
|
+
}, "se_ToolUseBlock");
|
|
1237
|
+
var se_Document = /* @__PURE__ */ __name((input, context) => {
|
|
1238
|
+
return input;
|
|
1239
|
+
}, "se_Document");
|
|
1240
|
+
var de_ContentBlock = /* @__PURE__ */ __name((output, context) => {
|
|
1241
|
+
if (output.image != null) {
|
|
1242
|
+
return {
|
|
1243
|
+
image: de_ImageBlock(output.image, context)
|
|
1244
|
+
};
|
|
1245
|
+
}
|
|
1246
|
+
if ((0, import_smithy_client.expectString)(output.text) !== void 0) {
|
|
1247
|
+
return { text: (0, import_smithy_client.expectString)(output.text) };
|
|
1248
|
+
}
|
|
1249
|
+
if (output.toolResult != null) {
|
|
1250
|
+
return {
|
|
1251
|
+
toolResult: de_ToolResultBlock(output.toolResult, context)
|
|
1252
|
+
};
|
|
1253
|
+
}
|
|
1254
|
+
if (output.toolUse != null) {
|
|
1255
|
+
return {
|
|
1256
|
+
toolUse: de_ToolUseBlock(output.toolUse, context)
|
|
1257
|
+
};
|
|
1258
|
+
}
|
|
1259
|
+
return { $unknown: Object.entries(output)[0] };
|
|
1260
|
+
}, "de_ContentBlock");
|
|
1261
|
+
var de_ContentBlocks = /* @__PURE__ */ __name((output, context) => {
|
|
1262
|
+
const retVal = (output || []).filter((e) => e != null).map((entry) => {
|
|
1263
|
+
return de_ContentBlock((0, import_core2.awsExpectUnion)(entry), context);
|
|
1264
|
+
});
|
|
1265
|
+
return retVal;
|
|
1266
|
+
}, "de_ContentBlocks");
|
|
1267
|
+
var de_ConverseOutput = /* @__PURE__ */ __name((output, context) => {
|
|
1268
|
+
if (output.message != null) {
|
|
1269
|
+
return {
|
|
1270
|
+
message: de_Message(output.message, context)
|
|
1271
|
+
};
|
|
1272
|
+
}
|
|
1273
|
+
return { $unknown: Object.entries(output)[0] };
|
|
1274
|
+
}, "de_ConverseOutput");
|
|
1275
|
+
var de_ImageBlock = /* @__PURE__ */ __name((output, context) => {
|
|
1276
|
+
return (0, import_smithy_client.take)(output, {
|
|
1277
|
+
format: import_smithy_client.expectString,
|
|
1278
|
+
source: (_) => de_ImageSource((0, import_core2.awsExpectUnion)(_), context)
|
|
1279
|
+
});
|
|
1280
|
+
}, "de_ImageBlock");
|
|
1281
|
+
var de_ImageSource = /* @__PURE__ */ __name((output, context) => {
|
|
1282
|
+
if (output.bytes != null) {
|
|
1283
|
+
return {
|
|
1284
|
+
bytes: context.base64Decoder(output.bytes)
|
|
1285
|
+
};
|
|
1286
|
+
}
|
|
1287
|
+
return { $unknown: Object.entries(output)[0] };
|
|
1288
|
+
}, "de_ImageSource");
|
|
1289
|
+
var de_Message = /* @__PURE__ */ __name((output, context) => {
|
|
1290
|
+
return (0, import_smithy_client.take)(output, {
|
|
1291
|
+
content: (_) => de_ContentBlocks(_, context),
|
|
1292
|
+
role: import_smithy_client.expectString
|
|
1293
|
+
});
|
|
1294
|
+
}, "de_Message");
|
|
1295
|
+
var de_MessageStopEvent = /* @__PURE__ */ __name((output, context) => {
|
|
1296
|
+
return (0, import_smithy_client.take)(output, {
|
|
1297
|
+
additionalModelResponseFields: (_) => de_Document(_, context),
|
|
1298
|
+
stopReason: import_smithy_client.expectString
|
|
1299
|
+
});
|
|
1300
|
+
}, "de_MessageStopEvent");
|
|
780
1301
|
var de_PayloadPart = /* @__PURE__ */ __name((output, context) => {
|
|
781
1302
|
return (0, import_smithy_client.take)(output, {
|
|
782
1303
|
bytes: context.base64Decoder
|
|
783
1304
|
});
|
|
784
1305
|
}, "de_PayloadPart");
|
|
1306
|
+
var de_ToolResultBlock = /* @__PURE__ */ __name((output, context) => {
|
|
1307
|
+
return (0, import_smithy_client.take)(output, {
|
|
1308
|
+
content: (_) => de_ToolResultContentBlocks(_, context),
|
|
1309
|
+
status: import_smithy_client.expectString,
|
|
1310
|
+
toolUseId: import_smithy_client.expectString
|
|
1311
|
+
});
|
|
1312
|
+
}, "de_ToolResultBlock");
|
|
1313
|
+
var de_ToolResultContentBlock = /* @__PURE__ */ __name((output, context) => {
|
|
1314
|
+
if (output.image != null) {
|
|
1315
|
+
return {
|
|
1316
|
+
image: de_ImageBlock(output.image, context)
|
|
1317
|
+
};
|
|
1318
|
+
}
|
|
1319
|
+
if (output.json != null) {
|
|
1320
|
+
return {
|
|
1321
|
+
json: de_Document(output.json, context)
|
|
1322
|
+
};
|
|
1323
|
+
}
|
|
1324
|
+
if ((0, import_smithy_client.expectString)(output.text) !== void 0) {
|
|
1325
|
+
return { text: (0, import_smithy_client.expectString)(output.text) };
|
|
1326
|
+
}
|
|
1327
|
+
return { $unknown: Object.entries(output)[0] };
|
|
1328
|
+
}, "de_ToolResultContentBlock");
|
|
1329
|
+
var de_ToolResultContentBlocks = /* @__PURE__ */ __name((output, context) => {
|
|
1330
|
+
const retVal = (output || []).filter((e) => e != null).map((entry) => {
|
|
1331
|
+
return de_ToolResultContentBlock((0, import_core2.awsExpectUnion)(entry), context);
|
|
1332
|
+
});
|
|
1333
|
+
return retVal;
|
|
1334
|
+
}, "de_ToolResultContentBlocks");
|
|
1335
|
+
var de_ToolUseBlock = /* @__PURE__ */ __name((output, context) => {
|
|
1336
|
+
return (0, import_smithy_client.take)(output, {
|
|
1337
|
+
input: (_) => de_Document(_, context),
|
|
1338
|
+
name: import_smithy_client.expectString,
|
|
1339
|
+
toolUseId: import_smithy_client.expectString
|
|
1340
|
+
});
|
|
1341
|
+
}, "de_ToolUseBlock");
|
|
1342
|
+
var de_Document = /* @__PURE__ */ __name((output, context) => {
|
|
1343
|
+
return output;
|
|
1344
|
+
}, "de_Document");
|
|
785
1345
|
var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
|
|
786
1346
|
httpStatusCode: output.statusCode,
|
|
787
1347
|
requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
|
|
@@ -801,7 +1361,48 @@ var _xabg = "x-amzn-bedrock-guardrailidentifier";
|
|
|
801
1361
|
var _xabg_ = "x-amzn-bedrock-guardrailversion";
|
|
802
1362
|
var _xabt = "x-amzn-bedrock-trace";
|
|
803
1363
|
|
|
1364
|
+
// src/commands/ConverseCommand.ts
|
|
1365
|
+
var _ConverseCommand = class _ConverseCommand extends import_smithy_client.Command.classBuilder().ep({
|
|
1366
|
+
...commonParams
|
|
1367
|
+
}).m(function(Command, cs, config, o) {
|
|
1368
|
+
return [
|
|
1369
|
+
(0, import_middleware_serde.getSerdePlugin)(config, this.serialize, this.deserialize),
|
|
1370
|
+
(0, import_middleware_endpoint.getEndpointPlugin)(config, Command.getEndpointParameterInstructions())
|
|
1371
|
+
];
|
|
1372
|
+
}).s("AmazonBedrockFrontendService", "Converse", {}).n("BedrockRuntimeClient", "ConverseCommand").f(void 0, void 0).ser(se_ConverseCommand).de(de_ConverseCommand).build() {
|
|
1373
|
+
};
|
|
1374
|
+
__name(_ConverseCommand, "ConverseCommand");
|
|
1375
|
+
var ConverseCommand = _ConverseCommand;
|
|
1376
|
+
|
|
1377
|
+
// src/commands/ConverseStreamCommand.ts
|
|
1378
|
+
|
|
1379
|
+
|
|
1380
|
+
|
|
1381
|
+
|
|
1382
|
+
var _ConverseStreamCommand = class _ConverseStreamCommand extends import_smithy_client.Command.classBuilder().ep({
|
|
1383
|
+
...commonParams
|
|
1384
|
+
}).m(function(Command, cs, config, o) {
|
|
1385
|
+
return [
|
|
1386
|
+
(0, import_middleware_serde.getSerdePlugin)(config, this.serialize, this.deserialize),
|
|
1387
|
+
(0, import_middleware_endpoint.getEndpointPlugin)(config, Command.getEndpointParameterInstructions())
|
|
1388
|
+
];
|
|
1389
|
+
}).s("AmazonBedrockFrontendService", "ConverseStream", {
|
|
1390
|
+
/**
|
|
1391
|
+
* @internal
|
|
1392
|
+
*/
|
|
1393
|
+
eventStream: {
|
|
1394
|
+
output: true
|
|
1395
|
+
}
|
|
1396
|
+
}).n("BedrockRuntimeClient", "ConverseStreamCommand").f(void 0, ConverseStreamResponseFilterSensitiveLog).ser(se_ConverseStreamCommand).de(de_ConverseStreamCommand).build() {
|
|
1397
|
+
};
|
|
1398
|
+
__name(_ConverseStreamCommand, "ConverseStreamCommand");
|
|
1399
|
+
var ConverseStreamCommand = _ConverseStreamCommand;
|
|
1400
|
+
|
|
804
1401
|
// src/commands/InvokeModelCommand.ts
|
|
1402
|
+
|
|
1403
|
+
|
|
1404
|
+
|
|
1405
|
+
|
|
805
1406
|
var _InvokeModelCommand = class _InvokeModelCommand extends import_smithy_client.Command.classBuilder().ep({
|
|
806
1407
|
...commonParams
|
|
807
1408
|
}).m(function(Command, cs, config, o) {
|
|
@@ -840,6 +1441,8 @@ var InvokeModelWithResponseStreamCommand = _InvokeModelWithResponseStreamCommand
|
|
|
840
1441
|
|
|
841
1442
|
// src/BedrockRuntime.ts
|
|
842
1443
|
var commands = {
|
|
1444
|
+
ConverseCommand,
|
|
1445
|
+
ConverseStreamCommand,
|
|
843
1446
|
InvokeModelCommand,
|
|
844
1447
|
InvokeModelWithResponseStreamCommand
|
|
845
1448
|
};
|
|
@@ -856,20 +1459,39 @@ var BedrockRuntime = _BedrockRuntime;
|
|
|
856
1459
|
BedrockRuntimeClient,
|
|
857
1460
|
BedrockRuntime,
|
|
858
1461
|
$Command,
|
|
1462
|
+
ConverseCommand,
|
|
1463
|
+
ConverseStreamCommand,
|
|
859
1464
|
InvokeModelCommand,
|
|
860
1465
|
InvokeModelWithResponseStreamCommand,
|
|
861
1466
|
AccessDeniedException,
|
|
1467
|
+
ImageFormat,
|
|
1468
|
+
ImageSource,
|
|
1469
|
+
ToolResultContentBlock,
|
|
1470
|
+
ToolResultStatus,
|
|
1471
|
+
ContentBlock,
|
|
1472
|
+
ConversationRole,
|
|
1473
|
+
SystemContentBlock,
|
|
1474
|
+
ToolChoice,
|
|
1475
|
+
ToolInputSchema,
|
|
1476
|
+
Tool,
|
|
1477
|
+
ConverseOutput,
|
|
1478
|
+
StopReason,
|
|
862
1479
|
InternalServerException,
|
|
863
|
-
Trace,
|
|
864
1480
|
ModelErrorException,
|
|
865
1481
|
ModelNotReadyException,
|
|
866
1482
|
ModelTimeoutException,
|
|
867
1483
|
ResourceNotFoundException,
|
|
868
|
-
ServiceQuotaExceededException,
|
|
869
1484
|
ThrottlingException,
|
|
870
1485
|
ValidationException,
|
|
1486
|
+
ContentBlockDelta,
|
|
1487
|
+
ContentBlockStart,
|
|
871
1488
|
ModelStreamErrorException,
|
|
1489
|
+
ConverseStreamOutput,
|
|
1490
|
+
Trace,
|
|
1491
|
+
ServiceQuotaExceededException,
|
|
872
1492
|
ResponseStream,
|
|
1493
|
+
ConverseStreamOutputFilterSensitiveLog,
|
|
1494
|
+
ConverseStreamResponseFilterSensitiveLog,
|
|
873
1495
|
InvokeModelRequestFilterSensitiveLog,
|
|
874
1496
|
InvokeModelResponseFilterSensitiveLog,
|
|
875
1497
|
InvokeModelWithResponseStreamRequestFilterSensitiveLog,
|