@aws-sdk/client-bedrock-runtime 3.613.0 → 3.614.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 CHANGED
@@ -22,6 +22,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
22
22
  var src_exports = {};
23
23
  __export(src_exports, {
24
24
  AccessDeniedException: () => AccessDeniedException,
25
+ ApplyGuardrailCommand: () => ApplyGuardrailCommand,
25
26
  BedrockRuntime: () => BedrockRuntime,
26
27
  BedrockRuntimeClient: () => BedrockRuntimeClient,
27
28
  BedrockRuntimeServiceException: () => BedrockRuntimeServiceException,
@@ -37,10 +38,17 @@ __export(src_exports, {
37
38
  ConverseStreamResponseFilterSensitiveLog: () => ConverseStreamResponseFilterSensitiveLog,
38
39
  DocumentFormat: () => DocumentFormat,
39
40
  DocumentSource: () => DocumentSource,
41
+ GuardrailAction: () => GuardrailAction,
42
+ GuardrailContentBlock: () => GuardrailContentBlock,
40
43
  GuardrailContentFilterConfidence: () => GuardrailContentFilterConfidence,
41
44
  GuardrailContentFilterType: () => GuardrailContentFilterType,
42
45
  GuardrailContentPolicyAction: () => GuardrailContentPolicyAction,
46
+ GuardrailContentQualifier: () => GuardrailContentQualifier,
47
+ GuardrailContentSource: () => GuardrailContentSource,
48
+ GuardrailContextualGroundingFilterType: () => GuardrailContextualGroundingFilterType,
49
+ GuardrailContextualGroundingPolicyAction: () => GuardrailContextualGroundingPolicyAction,
43
50
  GuardrailConverseContentBlock: () => GuardrailConverseContentBlock,
51
+ GuardrailConverseContentQualifier: () => GuardrailConverseContentQualifier,
44
52
  GuardrailManagedWordType: () => GuardrailManagedWordType,
45
53
  GuardrailPiiEntityType: () => GuardrailPiiEntityType,
46
54
  GuardrailSensitiveInformationPolicyAction: () => GuardrailSensitiveInformationPolicyAction,
@@ -229,7 +237,7 @@ var BedrockRuntimeClient = _BedrockRuntimeClient;
229
237
  // src/BedrockRuntime.ts
230
238
 
231
239
 
232
- // src/commands/ConverseCommand.ts
240
+ // src/commands/ApplyGuardrailCommand.ts
233
241
 
234
242
  var import_middleware_serde = require("@smithy/middleware-serde");
235
243
 
@@ -272,6 +280,186 @@ var _AccessDeniedException = class _AccessDeniedException extends BedrockRuntime
272
280
  };
273
281
  __name(_AccessDeniedException, "AccessDeniedException");
274
282
  var AccessDeniedException = _AccessDeniedException;
283
+ var GuardrailContentQualifier = {
284
+ GROUNDING_SOURCE: "grounding_source",
285
+ GUARD_CONTENT: "guard_content",
286
+ QUERY: "query"
287
+ };
288
+ var GuardrailContentBlock;
289
+ ((GuardrailContentBlock3) => {
290
+ GuardrailContentBlock3.visit = /* @__PURE__ */ __name((value, visitor) => {
291
+ if (value.text !== void 0)
292
+ return visitor.text(value.text);
293
+ return visitor._(value.$unknown[0], value.$unknown[1]);
294
+ }, "visit");
295
+ })(GuardrailContentBlock || (GuardrailContentBlock = {}));
296
+ var GuardrailContentSource = {
297
+ INPUT: "INPUT",
298
+ OUTPUT: "OUTPUT"
299
+ };
300
+ var GuardrailAction = {
301
+ GUARDRAIL_INTERVENED: "GUARDRAIL_INTERVENED",
302
+ NONE: "NONE"
303
+ };
304
+ var GuardrailContentPolicyAction = {
305
+ BLOCKED: "BLOCKED"
306
+ };
307
+ var GuardrailContentFilterConfidence = {
308
+ HIGH: "HIGH",
309
+ LOW: "LOW",
310
+ MEDIUM: "MEDIUM",
311
+ NONE: "NONE"
312
+ };
313
+ var GuardrailContentFilterType = {
314
+ HATE: "HATE",
315
+ INSULTS: "INSULTS",
316
+ MISCONDUCT: "MISCONDUCT",
317
+ PROMPT_ATTACK: "PROMPT_ATTACK",
318
+ SEXUAL: "SEXUAL",
319
+ VIOLENCE: "VIOLENCE"
320
+ };
321
+ var GuardrailContextualGroundingPolicyAction = {
322
+ BLOCKED: "BLOCKED",
323
+ NONE: "NONE"
324
+ };
325
+ var GuardrailContextualGroundingFilterType = {
326
+ GROUNDING: "GROUNDING",
327
+ RELEVANCE: "RELEVANCE"
328
+ };
329
+ var GuardrailSensitiveInformationPolicyAction = {
330
+ ANONYMIZED: "ANONYMIZED",
331
+ BLOCKED: "BLOCKED"
332
+ };
333
+ var GuardrailPiiEntityType = {
334
+ ADDRESS: "ADDRESS",
335
+ AGE: "AGE",
336
+ AWS_ACCESS_KEY: "AWS_ACCESS_KEY",
337
+ AWS_SECRET_KEY: "AWS_SECRET_KEY",
338
+ CA_HEALTH_NUMBER: "CA_HEALTH_NUMBER",
339
+ CA_SOCIAL_INSURANCE_NUMBER: "CA_SOCIAL_INSURANCE_NUMBER",
340
+ CREDIT_DEBIT_CARD_CVV: "CREDIT_DEBIT_CARD_CVV",
341
+ CREDIT_DEBIT_CARD_EXPIRY: "CREDIT_DEBIT_CARD_EXPIRY",
342
+ CREDIT_DEBIT_CARD_NUMBER: "CREDIT_DEBIT_CARD_NUMBER",
343
+ DRIVER_ID: "DRIVER_ID",
344
+ EMAIL: "EMAIL",
345
+ INTERNATIONAL_BANK_ACCOUNT_NUMBER: "INTERNATIONAL_BANK_ACCOUNT_NUMBER",
346
+ IP_ADDRESS: "IP_ADDRESS",
347
+ LICENSE_PLATE: "LICENSE_PLATE",
348
+ MAC_ADDRESS: "MAC_ADDRESS",
349
+ NAME: "NAME",
350
+ PASSWORD: "PASSWORD",
351
+ PHONE: "PHONE",
352
+ PIN: "PIN",
353
+ SWIFT_CODE: "SWIFT_CODE",
354
+ UK_NATIONAL_HEALTH_SERVICE_NUMBER: "UK_NATIONAL_HEALTH_SERVICE_NUMBER",
355
+ UK_NATIONAL_INSURANCE_NUMBER: "UK_NATIONAL_INSURANCE_NUMBER",
356
+ UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER: "UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER",
357
+ URL: "URL",
358
+ USERNAME: "USERNAME",
359
+ US_BANK_ACCOUNT_NUMBER: "US_BANK_ACCOUNT_NUMBER",
360
+ US_BANK_ROUTING_NUMBER: "US_BANK_ROUTING_NUMBER",
361
+ US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER: "US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER",
362
+ US_PASSPORT_NUMBER: "US_PASSPORT_NUMBER",
363
+ US_SOCIAL_SECURITY_NUMBER: "US_SOCIAL_SECURITY_NUMBER",
364
+ VEHICLE_IDENTIFICATION_NUMBER: "VEHICLE_IDENTIFICATION_NUMBER"
365
+ };
366
+ var GuardrailTopicPolicyAction = {
367
+ BLOCKED: "BLOCKED"
368
+ };
369
+ var GuardrailTopicType = {
370
+ DENY: "DENY"
371
+ };
372
+ var GuardrailWordPolicyAction = {
373
+ BLOCKED: "BLOCKED"
374
+ };
375
+ var GuardrailManagedWordType = {
376
+ PROFANITY: "PROFANITY"
377
+ };
378
+ var _InternalServerException = class _InternalServerException extends BedrockRuntimeServiceException {
379
+ /**
380
+ * @internal
381
+ */
382
+ constructor(opts) {
383
+ super({
384
+ name: "InternalServerException",
385
+ $fault: "server",
386
+ ...opts
387
+ });
388
+ this.name = "InternalServerException";
389
+ this.$fault = "server";
390
+ Object.setPrototypeOf(this, _InternalServerException.prototype);
391
+ }
392
+ };
393
+ __name(_InternalServerException, "InternalServerException");
394
+ var InternalServerException = _InternalServerException;
395
+ var _ResourceNotFoundException = class _ResourceNotFoundException extends BedrockRuntimeServiceException {
396
+ /**
397
+ * @internal
398
+ */
399
+ constructor(opts) {
400
+ super({
401
+ name: "ResourceNotFoundException",
402
+ $fault: "client",
403
+ ...opts
404
+ });
405
+ this.name = "ResourceNotFoundException";
406
+ this.$fault = "client";
407
+ Object.setPrototypeOf(this, _ResourceNotFoundException.prototype);
408
+ }
409
+ };
410
+ __name(_ResourceNotFoundException, "ResourceNotFoundException");
411
+ var ResourceNotFoundException = _ResourceNotFoundException;
412
+ var _ServiceQuotaExceededException = class _ServiceQuotaExceededException extends BedrockRuntimeServiceException {
413
+ /**
414
+ * @internal
415
+ */
416
+ constructor(opts) {
417
+ super({
418
+ name: "ServiceQuotaExceededException",
419
+ $fault: "client",
420
+ ...opts
421
+ });
422
+ this.name = "ServiceQuotaExceededException";
423
+ this.$fault = "client";
424
+ Object.setPrototypeOf(this, _ServiceQuotaExceededException.prototype);
425
+ }
426
+ };
427
+ __name(_ServiceQuotaExceededException, "ServiceQuotaExceededException");
428
+ var ServiceQuotaExceededException = _ServiceQuotaExceededException;
429
+ var _ThrottlingException = class _ThrottlingException extends BedrockRuntimeServiceException {
430
+ /**
431
+ * @internal
432
+ */
433
+ constructor(opts) {
434
+ super({
435
+ name: "ThrottlingException",
436
+ $fault: "client",
437
+ ...opts
438
+ });
439
+ this.name = "ThrottlingException";
440
+ this.$fault = "client";
441
+ Object.setPrototypeOf(this, _ThrottlingException.prototype);
442
+ }
443
+ };
444
+ __name(_ThrottlingException, "ThrottlingException");
445
+ var ThrottlingException = _ThrottlingException;
446
+ var _ValidationException = class _ValidationException extends BedrockRuntimeServiceException {
447
+ /**
448
+ * @internal
449
+ */
450
+ constructor(opts) {
451
+ super({
452
+ name: "ValidationException",
453
+ $fault: "client",
454
+ ...opts
455
+ });
456
+ this.name = "ValidationException";
457
+ this.$fault = "client";
458
+ Object.setPrototypeOf(this, _ValidationException.prototype);
459
+ }
460
+ };
461
+ __name(_ValidationException, "ValidationException");
462
+ var ValidationException = _ValidationException;
275
463
  var GuardrailTrace = {
276
464
  DISABLED: "disabled",
277
465
  ENABLED: "enabled"
@@ -295,6 +483,11 @@ var DocumentSource;
295
483
  return visitor._(value.$unknown[0], value.$unknown[1]);
296
484
  }, "visit");
297
485
  })(DocumentSource || (DocumentSource = {}));
486
+ var GuardrailConverseContentQualifier = {
487
+ GROUNDING_SOURCE: "grounding_source",
488
+ GUARD_CONTENT: "guard_content",
489
+ QUERY: "query"
490
+ };
298
491
  var GuardrailConverseContentBlock;
299
492
  ((GuardrailConverseContentBlock3) => {
300
493
  GuardrailConverseContentBlock3.visit = /* @__PURE__ */ __name((value, visitor) => {
@@ -411,89 +604,6 @@ var StopReason = {
411
604
  STOP_SEQUENCE: "stop_sequence",
412
605
  TOOL_USE: "tool_use"
413
606
  };
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
- };
480
- var _InternalServerException = class _InternalServerException extends BedrockRuntimeServiceException {
481
- /**
482
- * @internal
483
- */
484
- constructor(opts) {
485
- super({
486
- name: "InternalServerException",
487
- $fault: "server",
488
- ...opts
489
- });
490
- this.name = "InternalServerException";
491
- this.$fault = "server";
492
- Object.setPrototypeOf(this, _InternalServerException.prototype);
493
- }
494
- };
495
- __name(_InternalServerException, "InternalServerException");
496
- var InternalServerException = _InternalServerException;
497
607
  var _ModelErrorException = class _ModelErrorException extends BedrockRuntimeServiceException {
498
608
  /**
499
609
  * @internal
@@ -547,57 +657,6 @@ var _ModelTimeoutException = class _ModelTimeoutException extends BedrockRuntime
547
657
  };
548
658
  __name(_ModelTimeoutException, "ModelTimeoutException");
549
659
  var ModelTimeoutException = _ModelTimeoutException;
550
- var _ResourceNotFoundException = class _ResourceNotFoundException extends BedrockRuntimeServiceException {
551
- /**
552
- * @internal
553
- */
554
- constructor(opts) {
555
- super({
556
- name: "ResourceNotFoundException",
557
- $fault: "client",
558
- ...opts
559
- });
560
- this.name = "ResourceNotFoundException";
561
- this.$fault = "client";
562
- Object.setPrototypeOf(this, _ResourceNotFoundException.prototype);
563
- }
564
- };
565
- __name(_ResourceNotFoundException, "ResourceNotFoundException");
566
- var ResourceNotFoundException = _ResourceNotFoundException;
567
- var _ThrottlingException = class _ThrottlingException extends BedrockRuntimeServiceException {
568
- /**
569
- * @internal
570
- */
571
- constructor(opts) {
572
- super({
573
- name: "ThrottlingException",
574
- $fault: "client",
575
- ...opts
576
- });
577
- this.name = "ThrottlingException";
578
- this.$fault = "client";
579
- Object.setPrototypeOf(this, _ThrottlingException.prototype);
580
- }
581
- };
582
- __name(_ThrottlingException, "ThrottlingException");
583
- var ThrottlingException = _ThrottlingException;
584
- var _ValidationException = class _ValidationException extends BedrockRuntimeServiceException {
585
- /**
586
- * @internal
587
- */
588
- constructor(opts) {
589
- super({
590
- name: "ValidationException",
591
- $fault: "client",
592
- ...opts
593
- });
594
- this.name = "ValidationException";
595
- this.$fault = "client";
596
- Object.setPrototypeOf(this, _ValidationException.prototype);
597
- }
598
- };
599
- __name(_ValidationException, "ValidationException");
600
- var ValidationException = _ValidationException;
601
660
  var GuardrailStreamProcessingMode = {
602
661
  ASYNC: "async",
603
662
  SYNC: "sync"
@@ -669,23 +728,6 @@ var Trace = {
669
728
  DISABLED: "DISABLED",
670
729
  ENABLED: "ENABLED"
671
730
  };
672
- var _ServiceQuotaExceededException = class _ServiceQuotaExceededException extends BedrockRuntimeServiceException {
673
- /**
674
- * @internal
675
- */
676
- constructor(opts) {
677
- super({
678
- name: "ServiceQuotaExceededException",
679
- $fault: "client",
680
- ...opts
681
- });
682
- this.name = "ServiceQuotaExceededException";
683
- this.$fault = "client";
684
- Object.setPrototypeOf(this, _ServiceQuotaExceededException.prototype);
685
- }
686
- };
687
- __name(_ServiceQuotaExceededException, "ServiceQuotaExceededException");
688
- var ServiceQuotaExceededException = _ServiceQuotaExceededException;
689
731
  var ResponseStream;
690
732
  ((ResponseStream3) => {
691
733
  ResponseStream3.visit = /* @__PURE__ */ __name((value, visitor) => {
@@ -770,6 +812,24 @@ var InvokeModelWithResponseStreamResponseFilterSensitiveLog = /* @__PURE__ */ __
770
812
  }), "InvokeModelWithResponseStreamResponseFilterSensitiveLog");
771
813
 
772
814
  // src/protocols/Aws_restJson1.ts
815
+ var se_ApplyGuardrailCommand = /* @__PURE__ */ __name(async (input, context) => {
816
+ const b = (0, import_core.requestBuilder)(input, context);
817
+ const headers = {
818
+ "content-type": "application/json"
819
+ };
820
+ b.bp("/guardrail/{guardrailIdentifier}/version/{guardrailVersion}/apply");
821
+ b.p("guardrailIdentifier", () => input.guardrailIdentifier, "{guardrailIdentifier}", false);
822
+ b.p("guardrailVersion", () => input.guardrailVersion, "{guardrailVersion}", false);
823
+ let body;
824
+ body = JSON.stringify(
825
+ (0, import_smithy_client.take)(input, {
826
+ content: (_) => (0, import_smithy_client._json)(_),
827
+ source: []
828
+ })
829
+ );
830
+ b.m("POST").h(headers).b(body);
831
+ return b.build();
832
+ }, "se_ApplyGuardrailCommand");
773
833
  var se_ConverseCommand = /* @__PURE__ */ __name(async (input, context) => {
774
834
  const b = (0, import_core.requestBuilder)(input, context);
775
835
  const headers = {
@@ -850,6 +910,23 @@ var se_InvokeModelWithResponseStreamCommand = /* @__PURE__ */ __name(async (inpu
850
910
  b.m("POST").h(headers).b(body);
851
911
  return b.build();
852
912
  }, "se_InvokeModelWithResponseStreamCommand");
913
+ var de_ApplyGuardrailCommand = /* @__PURE__ */ __name(async (output, context) => {
914
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
915
+ return de_CommandError(output, context);
916
+ }
917
+ const contents = (0, import_smithy_client.map)({
918
+ $metadata: deserializeMetadata(output)
919
+ });
920
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
921
+ const doc = (0, import_smithy_client.take)(data, {
922
+ action: import_smithy_client.expectString,
923
+ assessments: (_) => de_GuardrailAssessmentList(_, context),
924
+ outputs: import_smithy_client._json,
925
+ usage: import_smithy_client._json
926
+ });
927
+ Object.assign(contents, doc);
928
+ return contents;
929
+ }, "de_ApplyGuardrailCommand");
853
930
  var de_ConverseCommand = /* @__PURE__ */ __name(async (output, context) => {
854
931
  if (output.statusCode !== 200 && output.statusCode >= 300) {
855
932
  return de_CommandError(output, context);
@@ -863,7 +940,7 @@ var de_ConverseCommand = /* @__PURE__ */ __name(async (output, context) => {
863
940
  metrics: import_smithy_client._json,
864
941
  output: (_) => de_ConverseOutput((0, import_core2.awsExpectUnion)(_), context),
865
942
  stopReason: import_smithy_client.expectString,
866
- trace: import_smithy_client._json,
943
+ trace: (_) => de_ConverseTrace(_, context),
867
944
  usage: import_smithy_client._json
868
945
  });
869
946
  Object.assign(contents, doc);
@@ -917,27 +994,27 @@ var de_CommandError = /* @__PURE__ */ __name(async (output, context) => {
917
994
  case "InternalServerException":
918
995
  case "com.amazonaws.bedrockruntime#InternalServerException":
919
996
  throw await de_InternalServerExceptionRes(parsedOutput, context);
920
- case "ModelErrorException":
921
- case "com.amazonaws.bedrockruntime#ModelErrorException":
922
- throw await de_ModelErrorExceptionRes(parsedOutput, context);
923
- case "ModelNotReadyException":
924
- case "com.amazonaws.bedrockruntime#ModelNotReadyException":
925
- throw await de_ModelNotReadyExceptionRes(parsedOutput, context);
926
- case "ModelTimeoutException":
927
- case "com.amazonaws.bedrockruntime#ModelTimeoutException":
928
- throw await de_ModelTimeoutExceptionRes(parsedOutput, context);
929
997
  case "ResourceNotFoundException":
930
998
  case "com.amazonaws.bedrockruntime#ResourceNotFoundException":
931
999
  throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
1000
+ case "ServiceQuotaExceededException":
1001
+ case "com.amazonaws.bedrockruntime#ServiceQuotaExceededException":
1002
+ throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context);
932
1003
  case "ThrottlingException":
933
1004
  case "com.amazonaws.bedrockruntime#ThrottlingException":
934
1005
  throw await de_ThrottlingExceptionRes(parsedOutput, context);
935
1006
  case "ValidationException":
936
1007
  case "com.amazonaws.bedrockruntime#ValidationException":
937
1008
  throw await de_ValidationExceptionRes(parsedOutput, context);
938
- case "ServiceQuotaExceededException":
939
- case "com.amazonaws.bedrockruntime#ServiceQuotaExceededException":
940
- throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context);
1009
+ case "ModelErrorException":
1010
+ case "com.amazonaws.bedrockruntime#ModelErrorException":
1011
+ throw await de_ModelErrorExceptionRes(parsedOutput, context);
1012
+ case "ModelNotReadyException":
1013
+ case "com.amazonaws.bedrockruntime#ModelNotReadyException":
1014
+ throw await de_ModelNotReadyExceptionRes(parsedOutput, context);
1015
+ case "ModelTimeoutException":
1016
+ case "com.amazonaws.bedrockruntime#ModelTimeoutException":
1017
+ throw await de_ModelTimeoutExceptionRes(parsedOutput, context);
941
1018
  case "ModelStreamErrorException":
942
1019
  case "com.amazonaws.bedrockruntime#ModelStreamErrorException":
943
1020
  throw await de_ModelStreamErrorExceptionRes(parsedOutput, context);
@@ -1202,7 +1279,7 @@ var de_ContentBlockStopEvent_event = /* @__PURE__ */ __name(async (output, conte
1202
1279
  var de_ConverseStreamMetadataEvent_event = /* @__PURE__ */ __name(async (output, context) => {
1203
1280
  const contents = {};
1204
1281
  const data = await (0, import_core2.parseJsonBody)(output.body, context);
1205
- Object.assign(contents, (0, import_smithy_client._json)(data));
1282
+ Object.assign(contents, de_ConverseStreamMetadataEvent(data, context));
1206
1283
  return contents;
1207
1284
  }, "de_ConverseStreamMetadataEvent_event");
1208
1285
  var de_InternalServerException_event = /* @__PURE__ */ __name(async (output, context) => {
@@ -1424,6 +1501,23 @@ var de_ConverseOutput = /* @__PURE__ */ __name((output, context) => {
1424
1501
  }
1425
1502
  return { $unknown: Object.entries(output)[0] };
1426
1503
  }, "de_ConverseOutput");
1504
+ var de_ConverseStreamMetadataEvent = /* @__PURE__ */ __name((output, context) => {
1505
+ return (0, import_smithy_client.take)(output, {
1506
+ metrics: import_smithy_client._json,
1507
+ trace: (_) => de_ConverseStreamTrace(_, context),
1508
+ usage: import_smithy_client._json
1509
+ });
1510
+ }, "de_ConverseStreamMetadataEvent");
1511
+ var de_ConverseStreamTrace = /* @__PURE__ */ __name((output, context) => {
1512
+ return (0, import_smithy_client.take)(output, {
1513
+ guardrail: (_) => de_GuardrailTraceAssessment(_, context)
1514
+ });
1515
+ }, "de_ConverseStreamTrace");
1516
+ var de_ConverseTrace = /* @__PURE__ */ __name((output, context) => {
1517
+ return (0, import_smithy_client.take)(output, {
1518
+ guardrail: (_) => de_GuardrailTraceAssessment(_, context)
1519
+ });
1520
+ }, "de_ConverseTrace");
1427
1521
  var de_DocumentBlock = /* @__PURE__ */ __name((output, context) => {
1428
1522
  return (0, import_smithy_client.take)(output, {
1429
1523
  format: import_smithy_client.expectString,
@@ -1439,6 +1533,65 @@ var de_DocumentSource = /* @__PURE__ */ __name((output, context) => {
1439
1533
  }
1440
1534
  return { $unknown: Object.entries(output)[0] };
1441
1535
  }, "de_DocumentSource");
1536
+ var de_GuardrailAssessment = /* @__PURE__ */ __name((output, context) => {
1537
+ return (0, import_smithy_client.take)(output, {
1538
+ contentPolicy: import_smithy_client._json,
1539
+ contextualGroundingPolicy: (_) => de_GuardrailContextualGroundingPolicyAssessment(_, context),
1540
+ sensitiveInformationPolicy: import_smithy_client._json,
1541
+ topicPolicy: import_smithy_client._json,
1542
+ wordPolicy: import_smithy_client._json
1543
+ });
1544
+ }, "de_GuardrailAssessment");
1545
+ var de_GuardrailAssessmentList = /* @__PURE__ */ __name((output, context) => {
1546
+ const retVal = (output || []).filter((e) => e != null).map((entry) => {
1547
+ return de_GuardrailAssessment(entry, context);
1548
+ });
1549
+ return retVal;
1550
+ }, "de_GuardrailAssessmentList");
1551
+ var de_GuardrailAssessmentListMap = /* @__PURE__ */ __name((output, context) => {
1552
+ return Object.entries(output).reduce((acc, [key, value]) => {
1553
+ if (value === null) {
1554
+ return acc;
1555
+ }
1556
+ acc[key] = de_GuardrailAssessmentList(value, context);
1557
+ return acc;
1558
+ }, {});
1559
+ }, "de_GuardrailAssessmentListMap");
1560
+ var de_GuardrailAssessmentMap = /* @__PURE__ */ __name((output, context) => {
1561
+ return Object.entries(output).reduce((acc, [key, value]) => {
1562
+ if (value === null) {
1563
+ return acc;
1564
+ }
1565
+ acc[key] = de_GuardrailAssessment(value, context);
1566
+ return acc;
1567
+ }, {});
1568
+ }, "de_GuardrailAssessmentMap");
1569
+ var de_GuardrailContextualGroundingFilter = /* @__PURE__ */ __name((output, context) => {
1570
+ return (0, import_smithy_client.take)(output, {
1571
+ action: import_smithy_client.expectString,
1572
+ score: import_smithy_client.limitedParseDouble,
1573
+ threshold: import_smithy_client.limitedParseDouble,
1574
+ type: import_smithy_client.expectString
1575
+ });
1576
+ }, "de_GuardrailContextualGroundingFilter");
1577
+ var de_GuardrailContextualGroundingFilters = /* @__PURE__ */ __name((output, context) => {
1578
+ const retVal = (output || []).filter((e) => e != null).map((entry) => {
1579
+ return de_GuardrailContextualGroundingFilter(entry, context);
1580
+ });
1581
+ return retVal;
1582
+ }, "de_GuardrailContextualGroundingFilters");
1583
+ var de_GuardrailContextualGroundingPolicyAssessment = /* @__PURE__ */ __name((output, context) => {
1584
+ return (0, import_smithy_client.take)(output, {
1585
+ filters: (_) => de_GuardrailContextualGroundingFilters(_, context)
1586
+ });
1587
+ }, "de_GuardrailContextualGroundingPolicyAssessment");
1588
+ var de_GuardrailTraceAssessment = /* @__PURE__ */ __name((output, context) => {
1589
+ return (0, import_smithy_client.take)(output, {
1590
+ inputAssessment: (_) => de_GuardrailAssessmentMap(_, context),
1591
+ modelOutput: import_smithy_client._json,
1592
+ outputAssessments: (_) => de_GuardrailAssessmentListMap(_, context)
1593
+ });
1594
+ }, "de_GuardrailTraceAssessment");
1442
1595
  var de_ImageBlock = /* @__PURE__ */ __name((output, context) => {
1443
1596
  return (0, import_smithy_client.take)(output, {
1444
1597
  format: import_smithy_client.expectString,
@@ -1533,7 +1686,23 @@ var _xabg = "x-amzn-bedrock-guardrailidentifier";
1533
1686
  var _xabg_ = "x-amzn-bedrock-guardrailversion";
1534
1687
  var _xabt = "x-amzn-bedrock-trace";
1535
1688
 
1689
+ // src/commands/ApplyGuardrailCommand.ts
1690
+ var _ApplyGuardrailCommand = class _ApplyGuardrailCommand extends import_smithy_client.Command.classBuilder().ep({
1691
+ ...commonParams
1692
+ }).m(function(Command, cs, config, o) {
1693
+ return [
1694
+ (0, import_middleware_serde.getSerdePlugin)(config, this.serialize, this.deserialize),
1695
+ (0, import_middleware_endpoint.getEndpointPlugin)(config, Command.getEndpointParameterInstructions())
1696
+ ];
1697
+ }).s("AmazonBedrockFrontendService", "ApplyGuardrail", {}).n("BedrockRuntimeClient", "ApplyGuardrailCommand").f(void 0, void 0).ser(se_ApplyGuardrailCommand).de(de_ApplyGuardrailCommand).build() {
1698
+ };
1699
+ __name(_ApplyGuardrailCommand, "ApplyGuardrailCommand");
1700
+ var ApplyGuardrailCommand = _ApplyGuardrailCommand;
1701
+
1536
1702
  // src/commands/ConverseCommand.ts
1703
+
1704
+
1705
+
1537
1706
  var _ConverseCommand = class _ConverseCommand extends import_smithy_client.Command.classBuilder().ep({
1538
1707
  ...commonParams
1539
1708
  }).m(function(Command, cs, config, o) {
@@ -1610,6 +1779,7 @@ var InvokeModelWithResponseStreamCommand = _InvokeModelWithResponseStreamCommand
1610
1779
 
1611
1780
  // src/BedrockRuntime.ts
1612
1781
  var commands = {
1782
+ ApplyGuardrailCommand,
1613
1783
  ConverseCommand,
1614
1784
  ConverseStreamCommand,
1615
1785
  InvokeModelCommand,
@@ -1628,14 +1798,36 @@ var BedrockRuntime = _BedrockRuntime;
1628
1798
  BedrockRuntimeClient,
1629
1799
  BedrockRuntime,
1630
1800
  $Command,
1801
+ ApplyGuardrailCommand,
1631
1802
  ConverseCommand,
1632
1803
  ConverseStreamCommand,
1633
1804
  InvokeModelCommand,
1634
1805
  InvokeModelWithResponseStreamCommand,
1635
1806
  AccessDeniedException,
1807
+ GuardrailContentQualifier,
1808
+ GuardrailContentBlock,
1809
+ GuardrailContentSource,
1810
+ GuardrailAction,
1811
+ GuardrailContentPolicyAction,
1812
+ GuardrailContentFilterConfidence,
1813
+ GuardrailContentFilterType,
1814
+ GuardrailContextualGroundingPolicyAction,
1815
+ GuardrailContextualGroundingFilterType,
1816
+ GuardrailSensitiveInformationPolicyAction,
1817
+ GuardrailPiiEntityType,
1818
+ GuardrailTopicPolicyAction,
1819
+ GuardrailTopicType,
1820
+ GuardrailWordPolicyAction,
1821
+ GuardrailManagedWordType,
1822
+ InternalServerException,
1823
+ ResourceNotFoundException,
1824
+ ServiceQuotaExceededException,
1825
+ ThrottlingException,
1826
+ ValidationException,
1636
1827
  GuardrailTrace,
1637
1828
  DocumentFormat,
1638
1829
  DocumentSource,
1830
+ GuardrailConverseContentQualifier,
1639
1831
  GuardrailConverseContentBlock,
1640
1832
  ImageFormat,
1641
1833
  ImageSource,
@@ -1649,29 +1841,15 @@ var BedrockRuntime = _BedrockRuntime;
1649
1841
  Tool,
1650
1842
  ConverseOutput,
1651
1843
  StopReason,
1652
- GuardrailContentPolicyAction,
1653
- GuardrailContentFilterConfidence,
1654
- GuardrailContentFilterType,
1655
- GuardrailSensitiveInformationPolicyAction,
1656
- GuardrailPiiEntityType,
1657
- GuardrailTopicPolicyAction,
1658
- GuardrailTopicType,
1659
- GuardrailWordPolicyAction,
1660
- GuardrailManagedWordType,
1661
- InternalServerException,
1662
1844
  ModelErrorException,
1663
1845
  ModelNotReadyException,
1664
1846
  ModelTimeoutException,
1665
- ResourceNotFoundException,
1666
- ThrottlingException,
1667
- ValidationException,
1668
1847
  GuardrailStreamProcessingMode,
1669
1848
  ContentBlockDelta,
1670
1849
  ContentBlockStart,
1671
1850
  ModelStreamErrorException,
1672
1851
  ConverseStreamOutput,
1673
1852
  Trace,
1674
- ServiceQuotaExceededException,
1675
1853
  ResponseStream,
1676
1854
  ConverseStreamOutputFilterSensitiveLog,
1677
1855
  ConverseStreamResponseFilterSensitiveLog,