@aws-sdk/client-bedrock-runtime 3.598.0 → 3.602.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/dist-cjs/index.js +187 -0
- package/dist-es/models/models_0.js +110 -0
- package/dist-es/protocols/Aws_restJson1.js +50 -1
- package/dist-types/commands/ConverseCommand.d.ts +173 -2
- package/dist-types/commands/ConverseStreamCommand.d.ts +154 -4
- package/dist-types/models/models_0.d.ts +690 -109
- package/dist-types/ts3.4/models/models_0.d.ts +287 -0
- package/package.json +4 -4
package/dist-cjs/index.js
CHANGED
|
@@ -35,6 +35,20 @@ __export(src_exports, {
|
|
|
35
35
|
ConverseStreamOutput: () => ConverseStreamOutput,
|
|
36
36
|
ConverseStreamOutputFilterSensitiveLog: () => ConverseStreamOutputFilterSensitiveLog,
|
|
37
37
|
ConverseStreamResponseFilterSensitiveLog: () => ConverseStreamResponseFilterSensitiveLog,
|
|
38
|
+
DocumentFormat: () => DocumentFormat,
|
|
39
|
+
DocumentSource: () => DocumentSource,
|
|
40
|
+
GuardrailContentFilterConfidence: () => GuardrailContentFilterConfidence,
|
|
41
|
+
GuardrailContentFilterType: () => GuardrailContentFilterType,
|
|
42
|
+
GuardrailContentPolicyAction: () => GuardrailContentPolicyAction,
|
|
43
|
+
GuardrailConverseContentBlock: () => GuardrailConverseContentBlock,
|
|
44
|
+
GuardrailManagedWordType: () => GuardrailManagedWordType,
|
|
45
|
+
GuardrailPiiEntityType: () => GuardrailPiiEntityType,
|
|
46
|
+
GuardrailSensitiveInformationPolicyAction: () => GuardrailSensitiveInformationPolicyAction,
|
|
47
|
+
GuardrailStreamProcessingMode: () => GuardrailStreamProcessingMode,
|
|
48
|
+
GuardrailTopicPolicyAction: () => GuardrailTopicPolicyAction,
|
|
49
|
+
GuardrailTopicType: () => GuardrailTopicType,
|
|
50
|
+
GuardrailTrace: () => GuardrailTrace,
|
|
51
|
+
GuardrailWordPolicyAction: () => GuardrailWordPolicyAction,
|
|
38
52
|
ImageFormat: () => ImageFormat,
|
|
39
53
|
ImageSource: () => ImageSource,
|
|
40
54
|
InternalServerException: () => InternalServerException,
|
|
@@ -258,6 +272,37 @@ var _AccessDeniedException = class _AccessDeniedException extends BedrockRuntime
|
|
|
258
272
|
};
|
|
259
273
|
__name(_AccessDeniedException, "AccessDeniedException");
|
|
260
274
|
var AccessDeniedException = _AccessDeniedException;
|
|
275
|
+
var GuardrailTrace = {
|
|
276
|
+
DISABLED: "disabled",
|
|
277
|
+
ENABLED: "enabled"
|
|
278
|
+
};
|
|
279
|
+
var DocumentFormat = {
|
|
280
|
+
CSV: "csv",
|
|
281
|
+
DOC: "doc",
|
|
282
|
+
DOCX: "docx",
|
|
283
|
+
HTML: "html",
|
|
284
|
+
MD: "md",
|
|
285
|
+
PDF: "pdf",
|
|
286
|
+
TXT: "txt",
|
|
287
|
+
XLS: "xls",
|
|
288
|
+
XLSX: "xlsx"
|
|
289
|
+
};
|
|
290
|
+
var DocumentSource;
|
|
291
|
+
((DocumentSource2) => {
|
|
292
|
+
DocumentSource2.visit = /* @__PURE__ */ __name((value, visitor) => {
|
|
293
|
+
if (value.bytes !== void 0)
|
|
294
|
+
return visitor.bytes(value.bytes);
|
|
295
|
+
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
296
|
+
}, "visit");
|
|
297
|
+
})(DocumentSource || (DocumentSource = {}));
|
|
298
|
+
var GuardrailConverseContentBlock;
|
|
299
|
+
((GuardrailConverseContentBlock3) => {
|
|
300
|
+
GuardrailConverseContentBlock3.visit = /* @__PURE__ */ __name((value, visitor) => {
|
|
301
|
+
if (value.text !== void 0)
|
|
302
|
+
return visitor.text(value.text);
|
|
303
|
+
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
304
|
+
}, "visit");
|
|
305
|
+
})(GuardrailConverseContentBlock || (GuardrailConverseContentBlock = {}));
|
|
261
306
|
var ImageFormat = {
|
|
262
307
|
GIF: "gif",
|
|
263
308
|
JPEG: "jpeg",
|
|
@@ -281,6 +326,8 @@ var ToolResultContentBlock;
|
|
|
281
326
|
return visitor.text(value.text);
|
|
282
327
|
if (value.image !== void 0)
|
|
283
328
|
return visitor.image(value.image);
|
|
329
|
+
if (value.document !== void 0)
|
|
330
|
+
return visitor.document(value.document);
|
|
284
331
|
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
285
332
|
}, "visit");
|
|
286
333
|
})(ToolResultContentBlock || (ToolResultContentBlock = {}));
|
|
@@ -295,10 +342,14 @@ var ContentBlock;
|
|
|
295
342
|
return visitor.text(value.text);
|
|
296
343
|
if (value.image !== void 0)
|
|
297
344
|
return visitor.image(value.image);
|
|
345
|
+
if (value.document !== void 0)
|
|
346
|
+
return visitor.document(value.document);
|
|
298
347
|
if (value.toolUse !== void 0)
|
|
299
348
|
return visitor.toolUse(value.toolUse);
|
|
300
349
|
if (value.toolResult !== void 0)
|
|
301
350
|
return visitor.toolResult(value.toolResult);
|
|
351
|
+
if (value.guardContent !== void 0)
|
|
352
|
+
return visitor.guardContent(value.guardContent);
|
|
302
353
|
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
303
354
|
}, "visit");
|
|
304
355
|
})(ContentBlock || (ContentBlock = {}));
|
|
@@ -311,6 +362,8 @@ var SystemContentBlock;
|
|
|
311
362
|
SystemContentBlock3.visit = /* @__PURE__ */ __name((value, visitor) => {
|
|
312
363
|
if (value.text !== void 0)
|
|
313
364
|
return visitor.text(value.text);
|
|
365
|
+
if (value.guardContent !== void 0)
|
|
366
|
+
return visitor.guardContent(value.guardContent);
|
|
314
367
|
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
315
368
|
}, "visit");
|
|
316
369
|
})(SystemContentBlock || (SystemContentBlock = {}));
|
|
@@ -353,10 +406,77 @@ var ConverseOutput;
|
|
|
353
406
|
var StopReason = {
|
|
354
407
|
CONTENT_FILTERED: "content_filtered",
|
|
355
408
|
END_TURN: "end_turn",
|
|
409
|
+
GUARDRAIL_INTERVENED: "guardrail_intervened",
|
|
356
410
|
MAX_TOKENS: "max_tokens",
|
|
357
411
|
STOP_SEQUENCE: "stop_sequence",
|
|
358
412
|
TOOL_USE: "tool_use"
|
|
359
413
|
};
|
|
414
|
+
var GuardrailContentPolicyAction = {
|
|
415
|
+
BLOCKED: "BLOCKED"
|
|
416
|
+
};
|
|
417
|
+
var GuardrailContentFilterConfidence = {
|
|
418
|
+
HIGH: "HIGH",
|
|
419
|
+
LOW: "LOW",
|
|
420
|
+
MEDIUM: "MEDIUM",
|
|
421
|
+
NONE: "NONE"
|
|
422
|
+
};
|
|
423
|
+
var GuardrailContentFilterType = {
|
|
424
|
+
HATE: "HATE",
|
|
425
|
+
INSULTS: "INSULTS",
|
|
426
|
+
MISCONDUCT: "MISCONDUCT",
|
|
427
|
+
PROMPT_ATTACK: "PROMPT_ATTACK",
|
|
428
|
+
SEXUAL: "SEXUAL",
|
|
429
|
+
VIOLENCE: "VIOLENCE"
|
|
430
|
+
};
|
|
431
|
+
var GuardrailSensitiveInformationPolicyAction = {
|
|
432
|
+
ANONYMIZED: "ANONYMIZED",
|
|
433
|
+
BLOCKED: "BLOCKED"
|
|
434
|
+
};
|
|
435
|
+
var GuardrailPiiEntityType = {
|
|
436
|
+
ADDRESS: "ADDRESS",
|
|
437
|
+
AGE: "AGE",
|
|
438
|
+
AWS_ACCESS_KEY: "AWS_ACCESS_KEY",
|
|
439
|
+
AWS_SECRET_KEY: "AWS_SECRET_KEY",
|
|
440
|
+
CA_HEALTH_NUMBER: "CA_HEALTH_NUMBER",
|
|
441
|
+
CA_SOCIAL_INSURANCE_NUMBER: "CA_SOCIAL_INSURANCE_NUMBER",
|
|
442
|
+
CREDIT_DEBIT_CARD_CVV: "CREDIT_DEBIT_CARD_CVV",
|
|
443
|
+
CREDIT_DEBIT_CARD_EXPIRY: "CREDIT_DEBIT_CARD_EXPIRY",
|
|
444
|
+
CREDIT_DEBIT_CARD_NUMBER: "CREDIT_DEBIT_CARD_NUMBER",
|
|
445
|
+
DRIVER_ID: "DRIVER_ID",
|
|
446
|
+
EMAIL: "EMAIL",
|
|
447
|
+
INTERNATIONAL_BANK_ACCOUNT_NUMBER: "INTERNATIONAL_BANK_ACCOUNT_NUMBER",
|
|
448
|
+
IP_ADDRESS: "IP_ADDRESS",
|
|
449
|
+
LICENSE_PLATE: "LICENSE_PLATE",
|
|
450
|
+
MAC_ADDRESS: "MAC_ADDRESS",
|
|
451
|
+
NAME: "NAME",
|
|
452
|
+
PASSWORD: "PASSWORD",
|
|
453
|
+
PHONE: "PHONE",
|
|
454
|
+
PIN: "PIN",
|
|
455
|
+
SWIFT_CODE: "SWIFT_CODE",
|
|
456
|
+
UK_NATIONAL_HEALTH_SERVICE_NUMBER: "UK_NATIONAL_HEALTH_SERVICE_NUMBER",
|
|
457
|
+
UK_NATIONAL_INSURANCE_NUMBER: "UK_NATIONAL_INSURANCE_NUMBER",
|
|
458
|
+
UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER: "UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER",
|
|
459
|
+
URL: "URL",
|
|
460
|
+
USERNAME: "USERNAME",
|
|
461
|
+
US_BANK_ACCOUNT_NUMBER: "US_BANK_ACCOUNT_NUMBER",
|
|
462
|
+
US_BANK_ROUTING_NUMBER: "US_BANK_ROUTING_NUMBER",
|
|
463
|
+
US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER: "US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER",
|
|
464
|
+
US_PASSPORT_NUMBER: "US_PASSPORT_NUMBER",
|
|
465
|
+
US_SOCIAL_SECURITY_NUMBER: "US_SOCIAL_SECURITY_NUMBER",
|
|
466
|
+
VEHICLE_IDENTIFICATION_NUMBER: "VEHICLE_IDENTIFICATION_NUMBER"
|
|
467
|
+
};
|
|
468
|
+
var GuardrailTopicPolicyAction = {
|
|
469
|
+
BLOCKED: "BLOCKED"
|
|
470
|
+
};
|
|
471
|
+
var GuardrailTopicType = {
|
|
472
|
+
DENY: "DENY"
|
|
473
|
+
};
|
|
474
|
+
var GuardrailWordPolicyAction = {
|
|
475
|
+
BLOCKED: "BLOCKED"
|
|
476
|
+
};
|
|
477
|
+
var GuardrailManagedWordType = {
|
|
478
|
+
PROFANITY: "PROFANITY"
|
|
479
|
+
};
|
|
360
480
|
var _InternalServerException = class _InternalServerException extends BedrockRuntimeServiceException {
|
|
361
481
|
/**
|
|
362
482
|
* @internal
|
|
@@ -478,6 +598,10 @@ var _ValidationException = class _ValidationException extends BedrockRuntimeServ
|
|
|
478
598
|
};
|
|
479
599
|
__name(_ValidationException, "ValidationException");
|
|
480
600
|
var ValidationException = _ValidationException;
|
|
601
|
+
var GuardrailStreamProcessingMode = {
|
|
602
|
+
ASYNC: "async",
|
|
603
|
+
SYNC: "sync"
|
|
604
|
+
};
|
|
481
605
|
var ContentBlockDelta;
|
|
482
606
|
((ContentBlockDelta2) => {
|
|
483
607
|
ContentBlockDelta2.visit = /* @__PURE__ */ __name((value, visitor) => {
|
|
@@ -658,6 +782,7 @@ var se_ConverseCommand = /* @__PURE__ */ __name(async (input, context) => {
|
|
|
658
782
|
(0, import_smithy_client.take)(input, {
|
|
659
783
|
additionalModelRequestFields: (_) => se_Document(_, context),
|
|
660
784
|
additionalModelResponseFieldPaths: (_) => (0, import_smithy_client._json)(_),
|
|
785
|
+
guardrailConfig: (_) => (0, import_smithy_client._json)(_),
|
|
661
786
|
inferenceConfig: (_) => se_InferenceConfiguration(_, context),
|
|
662
787
|
messages: (_) => se_Messages(_, context),
|
|
663
788
|
system: (_) => (0, import_smithy_client._json)(_),
|
|
@@ -679,6 +804,7 @@ var se_ConverseStreamCommand = /* @__PURE__ */ __name(async (input, context) =>
|
|
|
679
804
|
(0, import_smithy_client.take)(input, {
|
|
680
805
|
additionalModelRequestFields: (_) => se_Document(_, context),
|
|
681
806
|
additionalModelResponseFieldPaths: (_) => (0, import_smithy_client._json)(_),
|
|
807
|
+
guardrailConfig: (_) => (0, import_smithy_client._json)(_),
|
|
682
808
|
inferenceConfig: (_) => se_InferenceConfiguration(_, context),
|
|
683
809
|
messages: (_) => se_Messages(_, context),
|
|
684
810
|
system: (_) => (0, import_smithy_client._json)(_),
|
|
@@ -737,6 +863,7 @@ var de_ConverseCommand = /* @__PURE__ */ __name(async (output, context) => {
|
|
|
737
863
|
metrics: import_smithy_client._json,
|
|
738
864
|
output: (_) => de_ConverseOutput((0, import_core2.awsExpectUnion)(_), context),
|
|
739
865
|
stopReason: import_smithy_client.expectString,
|
|
866
|
+
trace: import_smithy_client._json,
|
|
740
867
|
usage: import_smithy_client._json
|
|
741
868
|
});
|
|
742
869
|
Object.assign(contents, doc);
|
|
@@ -1133,6 +1260,8 @@ var de_ValidationException_event = /* @__PURE__ */ __name(async (output, context
|
|
|
1133
1260
|
}, "de_ValidationException_event");
|
|
1134
1261
|
var se_ContentBlock = /* @__PURE__ */ __name((input, context) => {
|
|
1135
1262
|
return ContentBlock.visit(input, {
|
|
1263
|
+
document: (value) => ({ document: se_DocumentBlock(value, context) }),
|
|
1264
|
+
guardContent: (value) => ({ guardContent: (0, import_smithy_client._json)(value) }),
|
|
1136
1265
|
image: (value) => ({ image: se_ImageBlock(value, context) }),
|
|
1137
1266
|
text: (value) => ({ text: value }),
|
|
1138
1267
|
toolResult: (value) => ({ toolResult: se_ToolResultBlock(value, context) }),
|
|
@@ -1145,6 +1274,19 @@ var se_ContentBlocks = /* @__PURE__ */ __name((input, context) => {
|
|
|
1145
1274
|
return se_ContentBlock(entry, context);
|
|
1146
1275
|
});
|
|
1147
1276
|
}, "se_ContentBlocks");
|
|
1277
|
+
var se_DocumentBlock = /* @__PURE__ */ __name((input, context) => {
|
|
1278
|
+
return (0, import_smithy_client.take)(input, {
|
|
1279
|
+
format: [],
|
|
1280
|
+
name: [],
|
|
1281
|
+
source: (_) => se_DocumentSource(_, context)
|
|
1282
|
+
});
|
|
1283
|
+
}, "se_DocumentBlock");
|
|
1284
|
+
var se_DocumentSource = /* @__PURE__ */ __name((input, context) => {
|
|
1285
|
+
return DocumentSource.visit(input, {
|
|
1286
|
+
bytes: (value) => ({ bytes: context.base64Encoder(value) }),
|
|
1287
|
+
_: (name, value) => ({ name: value })
|
|
1288
|
+
});
|
|
1289
|
+
}, "se_DocumentSource");
|
|
1148
1290
|
var se_ImageBlock = /* @__PURE__ */ __name((input, context) => {
|
|
1149
1291
|
return (0, import_smithy_client.take)(input, {
|
|
1150
1292
|
format: [],
|
|
@@ -1203,6 +1345,7 @@ var se_ToolResultBlock = /* @__PURE__ */ __name((input, context) => {
|
|
|
1203
1345
|
}, "se_ToolResultBlock");
|
|
1204
1346
|
var se_ToolResultContentBlock = /* @__PURE__ */ __name((input, context) => {
|
|
1205
1347
|
return ToolResultContentBlock.visit(input, {
|
|
1348
|
+
document: (value) => ({ document: se_DocumentBlock(value, context) }),
|
|
1206
1349
|
image: (value) => ({ image: se_ImageBlock(value, context) }),
|
|
1207
1350
|
json: (value) => ({ json: se_Document(value, context) }),
|
|
1208
1351
|
text: (value) => ({ text: value }),
|
|
@@ -1237,6 +1380,16 @@ var se_Document = /* @__PURE__ */ __name((input, context) => {
|
|
|
1237
1380
|
return input;
|
|
1238
1381
|
}, "se_Document");
|
|
1239
1382
|
var de_ContentBlock = /* @__PURE__ */ __name((output, context) => {
|
|
1383
|
+
if (output.document != null) {
|
|
1384
|
+
return {
|
|
1385
|
+
document: de_DocumentBlock(output.document, context)
|
|
1386
|
+
};
|
|
1387
|
+
}
|
|
1388
|
+
if (output.guardContent != null) {
|
|
1389
|
+
return {
|
|
1390
|
+
guardContent: (0, import_smithy_client._json)((0, import_core2.awsExpectUnion)(output.guardContent))
|
|
1391
|
+
};
|
|
1392
|
+
}
|
|
1240
1393
|
if (output.image != null) {
|
|
1241
1394
|
return {
|
|
1242
1395
|
image: de_ImageBlock(output.image, context)
|
|
@@ -1271,6 +1424,21 @@ var de_ConverseOutput = /* @__PURE__ */ __name((output, context) => {
|
|
|
1271
1424
|
}
|
|
1272
1425
|
return { $unknown: Object.entries(output)[0] };
|
|
1273
1426
|
}, "de_ConverseOutput");
|
|
1427
|
+
var de_DocumentBlock = /* @__PURE__ */ __name((output, context) => {
|
|
1428
|
+
return (0, import_smithy_client.take)(output, {
|
|
1429
|
+
format: import_smithy_client.expectString,
|
|
1430
|
+
name: import_smithy_client.expectString,
|
|
1431
|
+
source: (_) => de_DocumentSource((0, import_core2.awsExpectUnion)(_), context)
|
|
1432
|
+
});
|
|
1433
|
+
}, "de_DocumentBlock");
|
|
1434
|
+
var de_DocumentSource = /* @__PURE__ */ __name((output, context) => {
|
|
1435
|
+
if (output.bytes != null) {
|
|
1436
|
+
return {
|
|
1437
|
+
bytes: context.base64Decoder(output.bytes)
|
|
1438
|
+
};
|
|
1439
|
+
}
|
|
1440
|
+
return { $unknown: Object.entries(output)[0] };
|
|
1441
|
+
}, "de_DocumentSource");
|
|
1274
1442
|
var de_ImageBlock = /* @__PURE__ */ __name((output, context) => {
|
|
1275
1443
|
return (0, import_smithy_client.take)(output, {
|
|
1276
1444
|
format: import_smithy_client.expectString,
|
|
@@ -1310,6 +1478,11 @@ var de_ToolResultBlock = /* @__PURE__ */ __name((output, context) => {
|
|
|
1310
1478
|
});
|
|
1311
1479
|
}, "de_ToolResultBlock");
|
|
1312
1480
|
var de_ToolResultContentBlock = /* @__PURE__ */ __name((output, context) => {
|
|
1481
|
+
if (output.document != null) {
|
|
1482
|
+
return {
|
|
1483
|
+
document: de_DocumentBlock(output.document, context)
|
|
1484
|
+
};
|
|
1485
|
+
}
|
|
1313
1486
|
if (output.image != null) {
|
|
1314
1487
|
return {
|
|
1315
1488
|
image: de_ImageBlock(output.image, context)
|
|
@@ -1460,6 +1633,10 @@ var BedrockRuntime = _BedrockRuntime;
|
|
|
1460
1633
|
InvokeModelCommand,
|
|
1461
1634
|
InvokeModelWithResponseStreamCommand,
|
|
1462
1635
|
AccessDeniedException,
|
|
1636
|
+
GuardrailTrace,
|
|
1637
|
+
DocumentFormat,
|
|
1638
|
+
DocumentSource,
|
|
1639
|
+
GuardrailConverseContentBlock,
|
|
1463
1640
|
ImageFormat,
|
|
1464
1641
|
ImageSource,
|
|
1465
1642
|
ToolResultContentBlock,
|
|
@@ -1472,6 +1649,15 @@ var BedrockRuntime = _BedrockRuntime;
|
|
|
1472
1649
|
Tool,
|
|
1473
1650
|
ConverseOutput,
|
|
1474
1651
|
StopReason,
|
|
1652
|
+
GuardrailContentPolicyAction,
|
|
1653
|
+
GuardrailContentFilterConfidence,
|
|
1654
|
+
GuardrailContentFilterType,
|
|
1655
|
+
GuardrailSensitiveInformationPolicyAction,
|
|
1656
|
+
GuardrailPiiEntityType,
|
|
1657
|
+
GuardrailTopicPolicyAction,
|
|
1658
|
+
GuardrailTopicType,
|
|
1659
|
+
GuardrailWordPolicyAction,
|
|
1660
|
+
GuardrailManagedWordType,
|
|
1475
1661
|
InternalServerException,
|
|
1476
1662
|
ModelErrorException,
|
|
1477
1663
|
ModelNotReadyException,
|
|
@@ -1479,6 +1665,7 @@ var BedrockRuntime = _BedrockRuntime;
|
|
|
1479
1665
|
ResourceNotFoundException,
|
|
1480
1666
|
ThrottlingException,
|
|
1481
1667
|
ValidationException,
|
|
1668
|
+
GuardrailStreamProcessingMode,
|
|
1482
1669
|
ContentBlockDelta,
|
|
1483
1670
|
ContentBlockStart,
|
|
1484
1671
|
ModelStreamErrorException,
|
|
@@ -12,6 +12,37 @@ export class AccessDeniedException extends __BaseException {
|
|
|
12
12
|
Object.setPrototypeOf(this, AccessDeniedException.prototype);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
+
export const GuardrailTrace = {
|
|
16
|
+
DISABLED: "disabled",
|
|
17
|
+
ENABLED: "enabled",
|
|
18
|
+
};
|
|
19
|
+
export const DocumentFormat = {
|
|
20
|
+
CSV: "csv",
|
|
21
|
+
DOC: "doc",
|
|
22
|
+
DOCX: "docx",
|
|
23
|
+
HTML: "html",
|
|
24
|
+
MD: "md",
|
|
25
|
+
PDF: "pdf",
|
|
26
|
+
TXT: "txt",
|
|
27
|
+
XLS: "xls",
|
|
28
|
+
XLSX: "xlsx",
|
|
29
|
+
};
|
|
30
|
+
export var DocumentSource;
|
|
31
|
+
(function (DocumentSource) {
|
|
32
|
+
DocumentSource.visit = (value, visitor) => {
|
|
33
|
+
if (value.bytes !== undefined)
|
|
34
|
+
return visitor.bytes(value.bytes);
|
|
35
|
+
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
36
|
+
};
|
|
37
|
+
})(DocumentSource || (DocumentSource = {}));
|
|
38
|
+
export var GuardrailConverseContentBlock;
|
|
39
|
+
(function (GuardrailConverseContentBlock) {
|
|
40
|
+
GuardrailConverseContentBlock.visit = (value, visitor) => {
|
|
41
|
+
if (value.text !== undefined)
|
|
42
|
+
return visitor.text(value.text);
|
|
43
|
+
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
44
|
+
};
|
|
45
|
+
})(GuardrailConverseContentBlock || (GuardrailConverseContentBlock = {}));
|
|
15
46
|
export const ImageFormat = {
|
|
16
47
|
GIF: "gif",
|
|
17
48
|
JPEG: "jpeg",
|
|
@@ -35,6 +66,8 @@ export var ToolResultContentBlock;
|
|
|
35
66
|
return visitor.text(value.text);
|
|
36
67
|
if (value.image !== undefined)
|
|
37
68
|
return visitor.image(value.image);
|
|
69
|
+
if (value.document !== undefined)
|
|
70
|
+
return visitor.document(value.document);
|
|
38
71
|
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
39
72
|
};
|
|
40
73
|
})(ToolResultContentBlock || (ToolResultContentBlock = {}));
|
|
@@ -49,10 +82,14 @@ export var ContentBlock;
|
|
|
49
82
|
return visitor.text(value.text);
|
|
50
83
|
if (value.image !== undefined)
|
|
51
84
|
return visitor.image(value.image);
|
|
85
|
+
if (value.document !== undefined)
|
|
86
|
+
return visitor.document(value.document);
|
|
52
87
|
if (value.toolUse !== undefined)
|
|
53
88
|
return visitor.toolUse(value.toolUse);
|
|
54
89
|
if (value.toolResult !== undefined)
|
|
55
90
|
return visitor.toolResult(value.toolResult);
|
|
91
|
+
if (value.guardContent !== undefined)
|
|
92
|
+
return visitor.guardContent(value.guardContent);
|
|
56
93
|
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
57
94
|
};
|
|
58
95
|
})(ContentBlock || (ContentBlock = {}));
|
|
@@ -65,6 +102,8 @@ export var SystemContentBlock;
|
|
|
65
102
|
SystemContentBlock.visit = (value, visitor) => {
|
|
66
103
|
if (value.text !== undefined)
|
|
67
104
|
return visitor.text(value.text);
|
|
105
|
+
if (value.guardContent !== undefined)
|
|
106
|
+
return visitor.guardContent(value.guardContent);
|
|
68
107
|
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
69
108
|
};
|
|
70
109
|
})(SystemContentBlock || (SystemContentBlock = {}));
|
|
@@ -107,10 +146,77 @@ export var ConverseOutput;
|
|
|
107
146
|
export const StopReason = {
|
|
108
147
|
CONTENT_FILTERED: "content_filtered",
|
|
109
148
|
END_TURN: "end_turn",
|
|
149
|
+
GUARDRAIL_INTERVENED: "guardrail_intervened",
|
|
110
150
|
MAX_TOKENS: "max_tokens",
|
|
111
151
|
STOP_SEQUENCE: "stop_sequence",
|
|
112
152
|
TOOL_USE: "tool_use",
|
|
113
153
|
};
|
|
154
|
+
export const GuardrailContentPolicyAction = {
|
|
155
|
+
BLOCKED: "BLOCKED",
|
|
156
|
+
};
|
|
157
|
+
export const GuardrailContentFilterConfidence = {
|
|
158
|
+
HIGH: "HIGH",
|
|
159
|
+
LOW: "LOW",
|
|
160
|
+
MEDIUM: "MEDIUM",
|
|
161
|
+
NONE: "NONE",
|
|
162
|
+
};
|
|
163
|
+
export const GuardrailContentFilterType = {
|
|
164
|
+
HATE: "HATE",
|
|
165
|
+
INSULTS: "INSULTS",
|
|
166
|
+
MISCONDUCT: "MISCONDUCT",
|
|
167
|
+
PROMPT_ATTACK: "PROMPT_ATTACK",
|
|
168
|
+
SEXUAL: "SEXUAL",
|
|
169
|
+
VIOLENCE: "VIOLENCE",
|
|
170
|
+
};
|
|
171
|
+
export const GuardrailSensitiveInformationPolicyAction = {
|
|
172
|
+
ANONYMIZED: "ANONYMIZED",
|
|
173
|
+
BLOCKED: "BLOCKED",
|
|
174
|
+
};
|
|
175
|
+
export const GuardrailPiiEntityType = {
|
|
176
|
+
ADDRESS: "ADDRESS",
|
|
177
|
+
AGE: "AGE",
|
|
178
|
+
AWS_ACCESS_KEY: "AWS_ACCESS_KEY",
|
|
179
|
+
AWS_SECRET_KEY: "AWS_SECRET_KEY",
|
|
180
|
+
CA_HEALTH_NUMBER: "CA_HEALTH_NUMBER",
|
|
181
|
+
CA_SOCIAL_INSURANCE_NUMBER: "CA_SOCIAL_INSURANCE_NUMBER",
|
|
182
|
+
CREDIT_DEBIT_CARD_CVV: "CREDIT_DEBIT_CARD_CVV",
|
|
183
|
+
CREDIT_DEBIT_CARD_EXPIRY: "CREDIT_DEBIT_CARD_EXPIRY",
|
|
184
|
+
CREDIT_DEBIT_CARD_NUMBER: "CREDIT_DEBIT_CARD_NUMBER",
|
|
185
|
+
DRIVER_ID: "DRIVER_ID",
|
|
186
|
+
EMAIL: "EMAIL",
|
|
187
|
+
INTERNATIONAL_BANK_ACCOUNT_NUMBER: "INTERNATIONAL_BANK_ACCOUNT_NUMBER",
|
|
188
|
+
IP_ADDRESS: "IP_ADDRESS",
|
|
189
|
+
LICENSE_PLATE: "LICENSE_PLATE",
|
|
190
|
+
MAC_ADDRESS: "MAC_ADDRESS",
|
|
191
|
+
NAME: "NAME",
|
|
192
|
+
PASSWORD: "PASSWORD",
|
|
193
|
+
PHONE: "PHONE",
|
|
194
|
+
PIN: "PIN",
|
|
195
|
+
SWIFT_CODE: "SWIFT_CODE",
|
|
196
|
+
UK_NATIONAL_HEALTH_SERVICE_NUMBER: "UK_NATIONAL_HEALTH_SERVICE_NUMBER",
|
|
197
|
+
UK_NATIONAL_INSURANCE_NUMBER: "UK_NATIONAL_INSURANCE_NUMBER",
|
|
198
|
+
UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER: "UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER",
|
|
199
|
+
URL: "URL",
|
|
200
|
+
USERNAME: "USERNAME",
|
|
201
|
+
US_BANK_ACCOUNT_NUMBER: "US_BANK_ACCOUNT_NUMBER",
|
|
202
|
+
US_BANK_ROUTING_NUMBER: "US_BANK_ROUTING_NUMBER",
|
|
203
|
+
US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER: "US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER",
|
|
204
|
+
US_PASSPORT_NUMBER: "US_PASSPORT_NUMBER",
|
|
205
|
+
US_SOCIAL_SECURITY_NUMBER: "US_SOCIAL_SECURITY_NUMBER",
|
|
206
|
+
VEHICLE_IDENTIFICATION_NUMBER: "VEHICLE_IDENTIFICATION_NUMBER",
|
|
207
|
+
};
|
|
208
|
+
export const GuardrailTopicPolicyAction = {
|
|
209
|
+
BLOCKED: "BLOCKED",
|
|
210
|
+
};
|
|
211
|
+
export const GuardrailTopicType = {
|
|
212
|
+
DENY: "DENY",
|
|
213
|
+
};
|
|
214
|
+
export const GuardrailWordPolicyAction = {
|
|
215
|
+
BLOCKED: "BLOCKED",
|
|
216
|
+
};
|
|
217
|
+
export const GuardrailManagedWordType = {
|
|
218
|
+
PROFANITY: "PROFANITY",
|
|
219
|
+
};
|
|
114
220
|
export class InternalServerException extends __BaseException {
|
|
115
221
|
constructor(opts) {
|
|
116
222
|
super({
|
|
@@ -197,6 +303,10 @@ export class ValidationException extends __BaseException {
|
|
|
197
303
|
Object.setPrototypeOf(this, ValidationException.prototype);
|
|
198
304
|
}
|
|
199
305
|
}
|
|
306
|
+
export const GuardrailStreamProcessingMode = {
|
|
307
|
+
ASYNC: "async",
|
|
308
|
+
SYNC: "sync",
|
|
309
|
+
};
|
|
200
310
|
export var ContentBlockDelta;
|
|
201
311
|
(function (ContentBlockDelta) {
|
|
202
312
|
ContentBlockDelta.visit = (value, visitor) => {
|
|
@@ -2,7 +2,7 @@ import { awsExpectUnion as __expectUnion, loadRestJsonErrorCode, parseJsonBody a
|
|
|
2
2
|
import { requestBuilder as rb } from "@smithy/core";
|
|
3
3
|
import { _json, collectBody, decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, map, serializeFloat as __serializeFloat, take, withBaseException, } from "@smithy/smithy-client";
|
|
4
4
|
import { BedrockRuntimeServiceException as __BaseException } from "../models/BedrockRuntimeServiceException";
|
|
5
|
-
import { AccessDeniedException, ContentBlock, ImageSource, InternalServerException, ModelErrorException, ModelNotReadyException, ModelStreamErrorException, ModelTimeoutException, ResourceNotFoundException, ServiceQuotaExceededException, ThrottlingException, Tool, ToolInputSchema, ToolResultContentBlock, ValidationException, } from "../models/models_0";
|
|
5
|
+
import { AccessDeniedException, ContentBlock, DocumentSource, ImageSource, InternalServerException, ModelErrorException, ModelNotReadyException, ModelStreamErrorException, ModelTimeoutException, ResourceNotFoundException, ServiceQuotaExceededException, ThrottlingException, Tool, ToolInputSchema, ToolResultContentBlock, ValidationException, } from "../models/models_0";
|
|
6
6
|
export const se_ConverseCommand = async (input, context) => {
|
|
7
7
|
const b = rb(input, context);
|
|
8
8
|
const headers = {
|
|
@@ -14,6 +14,7 @@ export const se_ConverseCommand = async (input, context) => {
|
|
|
14
14
|
body = JSON.stringify(take(input, {
|
|
15
15
|
additionalModelRequestFields: (_) => se_Document(_, context),
|
|
16
16
|
additionalModelResponseFieldPaths: (_) => _json(_),
|
|
17
|
+
guardrailConfig: (_) => _json(_),
|
|
17
18
|
inferenceConfig: (_) => se_InferenceConfiguration(_, context),
|
|
18
19
|
messages: (_) => se_Messages(_, context),
|
|
19
20
|
system: (_) => _json(_),
|
|
@@ -33,6 +34,7 @@ export const se_ConverseStreamCommand = async (input, context) => {
|
|
|
33
34
|
body = JSON.stringify(take(input, {
|
|
34
35
|
additionalModelRequestFields: (_) => se_Document(_, context),
|
|
35
36
|
additionalModelResponseFieldPaths: (_) => _json(_),
|
|
37
|
+
guardrailConfig: (_) => _json(_),
|
|
36
38
|
inferenceConfig: (_) => se_InferenceConfiguration(_, context),
|
|
37
39
|
messages: (_) => se_Messages(_, context),
|
|
38
40
|
system: (_) => _json(_),
|
|
@@ -90,6 +92,7 @@ export const de_ConverseCommand = async (output, context) => {
|
|
|
90
92
|
metrics: _json,
|
|
91
93
|
output: (_) => de_ConverseOutput(__expectUnion(_), context),
|
|
92
94
|
stopReason: __expectString,
|
|
95
|
+
trace: _json,
|
|
93
96
|
usage: _json,
|
|
94
97
|
});
|
|
95
98
|
Object.assign(contents, doc);
|
|
@@ -480,6 +483,8 @@ const de_ValidationException_event = async (output, context) => {
|
|
|
480
483
|
};
|
|
481
484
|
const se_ContentBlock = (input, context) => {
|
|
482
485
|
return ContentBlock.visit(input, {
|
|
486
|
+
document: (value) => ({ document: se_DocumentBlock(value, context) }),
|
|
487
|
+
guardContent: (value) => ({ guardContent: _json(value) }),
|
|
483
488
|
image: (value) => ({ image: se_ImageBlock(value, context) }),
|
|
484
489
|
text: (value) => ({ text: value }),
|
|
485
490
|
toolResult: (value) => ({ toolResult: se_ToolResultBlock(value, context) }),
|
|
@@ -494,6 +499,19 @@ const se_ContentBlocks = (input, context) => {
|
|
|
494
499
|
return se_ContentBlock(entry, context);
|
|
495
500
|
});
|
|
496
501
|
};
|
|
502
|
+
const se_DocumentBlock = (input, context) => {
|
|
503
|
+
return take(input, {
|
|
504
|
+
format: [],
|
|
505
|
+
name: [],
|
|
506
|
+
source: (_) => se_DocumentSource(_, context),
|
|
507
|
+
});
|
|
508
|
+
};
|
|
509
|
+
const se_DocumentSource = (input, context) => {
|
|
510
|
+
return DocumentSource.visit(input, {
|
|
511
|
+
bytes: (value) => ({ bytes: context.base64Encoder(value) }),
|
|
512
|
+
_: (name, value) => ({ name: value }),
|
|
513
|
+
});
|
|
514
|
+
};
|
|
497
515
|
const se_ImageBlock = (input, context) => {
|
|
498
516
|
return take(input, {
|
|
499
517
|
format: [],
|
|
@@ -554,6 +572,7 @@ const se_ToolResultBlock = (input, context) => {
|
|
|
554
572
|
};
|
|
555
573
|
const se_ToolResultContentBlock = (input, context) => {
|
|
556
574
|
return ToolResultContentBlock.visit(input, {
|
|
575
|
+
document: (value) => ({ document: se_DocumentBlock(value, context) }),
|
|
557
576
|
image: (value) => ({ image: se_ImageBlock(value, context) }),
|
|
558
577
|
json: (value) => ({ json: se_Document(value, context) }),
|
|
559
578
|
text: (value) => ({ text: value }),
|
|
@@ -592,6 +611,16 @@ const se_Document = (input, context) => {
|
|
|
592
611
|
return input;
|
|
593
612
|
};
|
|
594
613
|
const de_ContentBlock = (output, context) => {
|
|
614
|
+
if (output.document != null) {
|
|
615
|
+
return {
|
|
616
|
+
document: de_DocumentBlock(output.document, context),
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
if (output.guardContent != null) {
|
|
620
|
+
return {
|
|
621
|
+
guardContent: _json(__expectUnion(output.guardContent)),
|
|
622
|
+
};
|
|
623
|
+
}
|
|
595
624
|
if (output.image != null) {
|
|
596
625
|
return {
|
|
597
626
|
image: de_ImageBlock(output.image, context),
|
|
@@ -628,6 +657,21 @@ const de_ConverseOutput = (output, context) => {
|
|
|
628
657
|
}
|
|
629
658
|
return { $unknown: Object.entries(output)[0] };
|
|
630
659
|
};
|
|
660
|
+
const de_DocumentBlock = (output, context) => {
|
|
661
|
+
return take(output, {
|
|
662
|
+
format: __expectString,
|
|
663
|
+
name: __expectString,
|
|
664
|
+
source: (_) => de_DocumentSource(__expectUnion(_), context),
|
|
665
|
+
});
|
|
666
|
+
};
|
|
667
|
+
const de_DocumentSource = (output, context) => {
|
|
668
|
+
if (output.bytes != null) {
|
|
669
|
+
return {
|
|
670
|
+
bytes: context.base64Decoder(output.bytes),
|
|
671
|
+
};
|
|
672
|
+
}
|
|
673
|
+
return { $unknown: Object.entries(output)[0] };
|
|
674
|
+
};
|
|
631
675
|
const de_ImageBlock = (output, context) => {
|
|
632
676
|
return take(output, {
|
|
633
677
|
format: __expectString,
|
|
@@ -667,6 +711,11 @@ const de_ToolResultBlock = (output, context) => {
|
|
|
667
711
|
});
|
|
668
712
|
};
|
|
669
713
|
const de_ToolResultContentBlock = (output, context) => {
|
|
714
|
+
if (output.document != null) {
|
|
715
|
+
return {
|
|
716
|
+
document: de_DocumentBlock(output.document, context),
|
|
717
|
+
};
|
|
718
|
+
}
|
|
670
719
|
if (output.image != null) {
|
|
671
720
|
return {
|
|
672
721
|
image: de_ImageBlock(output.image, context),
|