@aws-sdk/client-bedrock-runtime 3.782.0 → 3.785.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.
Files changed (38) hide show
  1. package/README.md +8 -0
  2. package/dist-cjs/index.js +232 -8
  3. package/dist-cjs/runtimeConfig.browser.js +2 -0
  4. package/dist-cjs/runtimeConfig.js +2 -0
  5. package/dist-cjs/runtimeConfig.native.js +3 -0
  6. package/dist-es/BedrockRuntime.js +2 -0
  7. package/dist-es/BedrockRuntimeClient.js +4 -2
  8. package/dist-es/commands/InvokeModelWithBidirectionalStreamCommand.js +30 -0
  9. package/dist-es/commands/index.js +1 -0
  10. package/dist-es/models/models_0.js +78 -0
  11. package/dist-es/protocols/Aws_restJson1.js +105 -2
  12. package/dist-es/runtimeConfig.browser.js +3 -1
  13. package/dist-es/runtimeConfig.js +2 -0
  14. package/dist-es/runtimeConfig.native.js +3 -0
  15. package/dist-types/BedrockRuntime.d.ts +7 -0
  16. package/dist-types/BedrockRuntimeClient.d.ts +12 -4
  17. package/dist-types/commands/ApplyGuardrailCommand.d.ts +15 -6
  18. package/dist-types/commands/ConverseCommand.d.ts +28 -13
  19. package/dist-types/commands/ConverseStreamCommand.d.ts +28 -13
  20. package/dist-types/commands/InvokeModelCommand.d.ts +1 -1
  21. package/dist-types/commands/InvokeModelWithBidirectionalStreamCommand.d.ts +144 -0
  22. package/dist-types/commands/InvokeModelWithResponseStreamCommand.d.ts +1 -1
  23. package/dist-types/commands/index.d.ts +1 -0
  24. package/dist-types/models/models_0.d.ts +302 -0
  25. package/dist-types/protocols/Aws_restJson1.d.ts +9 -0
  26. package/dist-types/runtimeConfig.browser.d.ts +1 -0
  27. package/dist-types/runtimeConfig.d.ts +1 -0
  28. package/dist-types/runtimeConfig.native.d.ts +1 -0
  29. package/dist-types/ts3.4/BedrockRuntime.d.ts +23 -0
  30. package/dist-types/ts3.4/BedrockRuntimeClient.d.ts +14 -0
  31. package/dist-types/ts3.4/commands/InvokeModelWithBidirectionalStreamCommand.d.ts +51 -0
  32. package/dist-types/ts3.4/commands/index.d.ts +1 -0
  33. package/dist-types/ts3.4/models/models_0.d.ts +179 -0
  34. package/dist-types/ts3.4/protocols/Aws_restJson1.d.ts +12 -0
  35. package/dist-types/ts3.4/runtimeConfig.browser.d.ts +1 -0
  36. package/dist-types/ts3.4/runtimeConfig.d.ts +1 -0
  37. package/dist-types/ts3.4/runtimeConfig.native.d.ts +1 -0
  38. package/package.json +3 -1
package/README.md CHANGED
@@ -242,6 +242,14 @@ InvokeModel
242
242
 
243
243
  [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock-runtime/command/InvokeModelCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-runtime/Interface/InvokeModelCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-runtime/Interface/InvokeModelCommandOutput/)
244
244
 
245
+ </details>
246
+ <details>
247
+ <summary>
248
+ InvokeModelWithBidirectionalStream
249
+ </summary>
250
+
251
+ [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock-runtime/command/InvokeModelWithBidirectionalStreamCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-runtime/Interface/InvokeModelWithBidirectionalStreamCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-runtime/Interface/InvokeModelWithBidirectionalStreamCommandOutput/)
252
+
245
253
  </details>
246
254
  <details>
247
255
  <summary>
package/dist-cjs/index.js CHANGED
@@ -30,6 +30,8 @@ __export(index_exports, {
30
30
  BedrockRuntime: () => BedrockRuntime,
31
31
  BedrockRuntimeClient: () => BedrockRuntimeClient,
32
32
  BedrockRuntimeServiceException: () => BedrockRuntimeServiceException,
33
+ BidirectionalInputPayloadPartFilterSensitiveLog: () => BidirectionalInputPayloadPartFilterSensitiveLog,
34
+ BidirectionalOutputPayloadPartFilterSensitiveLog: () => BidirectionalOutputPayloadPartFilterSensitiveLog,
33
35
  CachePointType: () => CachePointType,
34
36
  ConflictException: () => ConflictException,
35
37
  ContentBlock: () => ContentBlock,
@@ -76,6 +78,7 @@ __export(index_exports, {
76
78
  GuardrailImageSource: () => GuardrailImageSource,
77
79
  GuardrailImageSourceFilterSensitiveLog: () => GuardrailImageSourceFilterSensitiveLog,
78
80
  GuardrailManagedWordType: () => GuardrailManagedWordType,
81
+ GuardrailOutputScope: () => GuardrailOutputScope,
79
82
  GuardrailPiiEntityType: () => GuardrailPiiEntityType,
80
83
  GuardrailSensitiveInformationPolicyAction: () => GuardrailSensitiveInformationPolicyAction,
81
84
  GuardrailStreamProcessingMode: () => GuardrailStreamProcessingMode,
@@ -89,6 +92,13 @@ __export(index_exports, {
89
92
  InvokeModelCommand: () => InvokeModelCommand,
90
93
  InvokeModelRequestFilterSensitiveLog: () => InvokeModelRequestFilterSensitiveLog,
91
94
  InvokeModelResponseFilterSensitiveLog: () => InvokeModelResponseFilterSensitiveLog,
95
+ InvokeModelWithBidirectionalStreamCommand: () => InvokeModelWithBidirectionalStreamCommand,
96
+ InvokeModelWithBidirectionalStreamInput: () => InvokeModelWithBidirectionalStreamInput,
97
+ InvokeModelWithBidirectionalStreamInputFilterSensitiveLog: () => InvokeModelWithBidirectionalStreamInputFilterSensitiveLog,
98
+ InvokeModelWithBidirectionalStreamOutput: () => InvokeModelWithBidirectionalStreamOutput,
99
+ InvokeModelWithBidirectionalStreamOutputFilterSensitiveLog: () => InvokeModelWithBidirectionalStreamOutputFilterSensitiveLog,
100
+ InvokeModelWithBidirectionalStreamRequestFilterSensitiveLog: () => InvokeModelWithBidirectionalStreamRequestFilterSensitiveLog,
101
+ InvokeModelWithBidirectionalStreamResponseFilterSensitiveLog: () => InvokeModelWithBidirectionalStreamResponseFilterSensitiveLog,
92
102
  InvokeModelWithResponseStreamCommand: () => InvokeModelWithResponseStreamCommand,
93
103
  InvokeModelWithResponseStreamRequestFilterSensitiveLog: () => InvokeModelWithResponseStreamRequestFilterSensitiveLog,
94
104
  InvokeModelWithResponseStreamResponseFilterSensitiveLog: () => InvokeModelWithResponseStreamResponseFilterSensitiveLog,
@@ -135,6 +145,7 @@ __export(index_exports, {
135
145
  module.exports = __toCommonJS(index_exports);
136
146
 
137
147
  // src/BedrockRuntimeClient.ts
148
+ var import_middleware_eventstream = require("@aws-sdk/middleware-eventstream");
138
149
  var import_middleware_host_header = require("@aws-sdk/middleware-host-header");
139
150
  var import_middleware_logger = require("@aws-sdk/middleware-logger");
140
151
  var import_middleware_recursion_detection = require("@aws-sdk/middleware-recursion-detection");
@@ -249,8 +260,9 @@ var BedrockRuntimeClient = class extends import_smithy_client.Client {
249
260
  const _config_6 = (0, import_middleware_endpoint.resolveEndpointConfig)(_config_5);
250
261
  const _config_7 = (0, import_eventstream_serde_config_resolver.resolveEventStreamSerdeConfig)(_config_6);
251
262
  const _config_8 = (0, import_httpAuthSchemeProvider.resolveHttpAuthSchemeConfig)(_config_7);
252
- const _config_9 = resolveRuntimeExtensions(_config_8, configuration?.extensions || []);
253
- this.config = _config_9;
263
+ const _config_9 = (0, import_middleware_eventstream.resolveEventStreamConfig)(_config_8);
264
+ const _config_10 = resolveRuntimeExtensions(_config_9, configuration?.extensions || []);
265
+ this.config = _config_10;
254
266
  this.middlewareStack.use((0, import_middleware_user_agent.getUserAgentPlugin)(this.config));
255
267
  this.middlewareStack.use((0, import_middleware_retry.getRetryPlugin)(this.config));
256
268
  this.middlewareStack.use((0, import_middleware_content_length.getContentLengthPlugin)(this.config));
@@ -491,6 +503,10 @@ var GuardrailContentBlock;
491
503
  return visitor._(value.$unknown[0], value.$unknown[1]);
492
504
  }, "visit");
493
505
  })(GuardrailContentBlock || (GuardrailContentBlock = {}));
506
+ var GuardrailOutputScope = {
507
+ FULL: "FULL",
508
+ INTERVENTIONS: "INTERVENTIONS"
509
+ };
494
510
  var GuardrailContentSource = {
495
511
  INPUT: "INPUT",
496
512
  OUTPUT: "OUTPUT"
@@ -500,7 +516,8 @@ var GuardrailAction = {
500
516
  NONE: "NONE"
501
517
  };
502
518
  var GuardrailContentPolicyAction = {
503
- BLOCKED: "BLOCKED"
519
+ BLOCKED: "BLOCKED",
520
+ NONE: "NONE"
504
521
  };
505
522
  var GuardrailContentFilterConfidence = {
506
523
  HIGH: "HIGH",
@@ -532,7 +549,8 @@ var GuardrailContextualGroundingFilterType = {
532
549
  };
533
550
  var GuardrailSensitiveInformationPolicyAction = {
534
551
  ANONYMIZED: "ANONYMIZED",
535
- BLOCKED: "BLOCKED"
552
+ BLOCKED: "BLOCKED",
553
+ NONE: "NONE"
536
554
  };
537
555
  var GuardrailPiiEntityType = {
538
556
  ADDRESS: "ADDRESS",
@@ -568,20 +586,23 @@ var GuardrailPiiEntityType = {
568
586
  VEHICLE_IDENTIFICATION_NUMBER: "VEHICLE_IDENTIFICATION_NUMBER"
569
587
  };
570
588
  var GuardrailTopicPolicyAction = {
571
- BLOCKED: "BLOCKED"
589
+ BLOCKED: "BLOCKED",
590
+ NONE: "NONE"
572
591
  };
573
592
  var GuardrailTopicType = {
574
593
  DENY: "DENY"
575
594
  };
576
595
  var GuardrailWordPolicyAction = {
577
- BLOCKED: "BLOCKED"
596
+ BLOCKED: "BLOCKED",
597
+ NONE: "NONE"
578
598
  };
579
599
  var GuardrailManagedWordType = {
580
600
  PROFANITY: "PROFANITY"
581
601
  };
582
602
  var GuardrailTrace = {
583
603
  DISABLED: "disabled",
584
- ENABLED: "enabled"
604
+ ENABLED: "enabled",
605
+ ENABLED_FULL: "enabled_full"
585
606
  };
586
607
  var CachePointType = {
587
608
  DEFAULT: "default"
@@ -909,8 +930,32 @@ var ConverseStreamOutput;
909
930
  })(ConverseStreamOutput || (ConverseStreamOutput = {}));
910
931
  var Trace = {
911
932
  DISABLED: "DISABLED",
912
- ENABLED: "ENABLED"
933
+ ENABLED: "ENABLED",
934
+ ENABLED_FULL: "ENABLED_FULL"
913
935
  };
936
+ var InvokeModelWithBidirectionalStreamInput;
937
+ ((InvokeModelWithBidirectionalStreamInput2) => {
938
+ InvokeModelWithBidirectionalStreamInput2.visit = /* @__PURE__ */ __name((value, visitor) => {
939
+ if (value.chunk !== void 0) return visitor.chunk(value.chunk);
940
+ return visitor._(value.$unknown[0], value.$unknown[1]);
941
+ }, "visit");
942
+ })(InvokeModelWithBidirectionalStreamInput || (InvokeModelWithBidirectionalStreamInput = {}));
943
+ var InvokeModelWithBidirectionalStreamOutput;
944
+ ((InvokeModelWithBidirectionalStreamOutput3) => {
945
+ InvokeModelWithBidirectionalStreamOutput3.visit = /* @__PURE__ */ __name((value, visitor) => {
946
+ if (value.chunk !== void 0) return visitor.chunk(value.chunk);
947
+ if (value.internalServerException !== void 0)
948
+ return visitor.internalServerException(value.internalServerException);
949
+ if (value.modelStreamErrorException !== void 0)
950
+ return visitor.modelStreamErrorException(value.modelStreamErrorException);
951
+ if (value.validationException !== void 0) return visitor.validationException(value.validationException);
952
+ if (value.throttlingException !== void 0) return visitor.throttlingException(value.throttlingException);
953
+ if (value.modelTimeoutException !== void 0) return visitor.modelTimeoutException(value.modelTimeoutException);
954
+ if (value.serviceUnavailableException !== void 0)
955
+ return visitor.serviceUnavailableException(value.serviceUnavailableException);
956
+ return visitor._(value.$unknown[0], value.$unknown[1]);
957
+ }, "visit");
958
+ })(InvokeModelWithBidirectionalStreamOutput || (InvokeModelWithBidirectionalStreamOutput = {}));
914
959
  var ResponseStream;
915
960
  ((ResponseStream3) => {
916
961
  ResponseStream3.visit = /* @__PURE__ */ __name((value, visitor) => {
@@ -1078,6 +1123,37 @@ var InvokeModelResponseFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({
1078
1123
  ...obj,
1079
1124
  ...obj.body && { body: import_smithy_client.SENSITIVE_STRING }
1080
1125
  }), "InvokeModelResponseFilterSensitiveLog");
1126
+ var BidirectionalInputPayloadPartFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({
1127
+ ...obj,
1128
+ ...obj.bytes && { bytes: import_smithy_client.SENSITIVE_STRING }
1129
+ }), "BidirectionalInputPayloadPartFilterSensitiveLog");
1130
+ var InvokeModelWithBidirectionalStreamInputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => {
1131
+ if (obj.chunk !== void 0) return { chunk: import_smithy_client.SENSITIVE_STRING };
1132
+ if (obj.$unknown !== void 0) return { [obj.$unknown[0]]: "UNKNOWN" };
1133
+ }, "InvokeModelWithBidirectionalStreamInputFilterSensitiveLog");
1134
+ var InvokeModelWithBidirectionalStreamRequestFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({
1135
+ ...obj,
1136
+ ...obj.body && { body: "STREAMING_CONTENT" }
1137
+ }), "InvokeModelWithBidirectionalStreamRequestFilterSensitiveLog");
1138
+ var BidirectionalOutputPayloadPartFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({
1139
+ ...obj,
1140
+ ...obj.bytes && { bytes: import_smithy_client.SENSITIVE_STRING }
1141
+ }), "BidirectionalOutputPayloadPartFilterSensitiveLog");
1142
+ var InvokeModelWithBidirectionalStreamOutputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => {
1143
+ if (obj.chunk !== void 0) return { chunk: import_smithy_client.SENSITIVE_STRING };
1144
+ if (obj.internalServerException !== void 0) return { internalServerException: obj.internalServerException };
1145
+ if (obj.modelStreamErrorException !== void 0) return { modelStreamErrorException: obj.modelStreamErrorException };
1146
+ if (obj.validationException !== void 0) return { validationException: obj.validationException };
1147
+ if (obj.throttlingException !== void 0) return { throttlingException: obj.throttlingException };
1148
+ if (obj.modelTimeoutException !== void 0) return { modelTimeoutException: obj.modelTimeoutException };
1149
+ if (obj.serviceUnavailableException !== void 0)
1150
+ return { serviceUnavailableException: obj.serviceUnavailableException };
1151
+ if (obj.$unknown !== void 0) return { [obj.$unknown[0]]: "UNKNOWN" };
1152
+ }, "InvokeModelWithBidirectionalStreamOutputFilterSensitiveLog");
1153
+ var InvokeModelWithBidirectionalStreamResponseFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({
1154
+ ...obj,
1155
+ ...obj.body && { body: "STREAMING_CONTENT" }
1156
+ }), "InvokeModelWithBidirectionalStreamResponseFilterSensitiveLog");
1081
1157
  var InvokeModelWithResponseStreamRequestFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({
1082
1158
  ...obj,
1083
1159
  ...obj.body && { body: import_smithy_client.SENSITIVE_STRING }
@@ -1119,6 +1195,7 @@ var se_ApplyGuardrailCommand = /* @__PURE__ */ __name(async (input, context) =>
1119
1195
  body = JSON.stringify(
1120
1196
  (0, import_smithy_client.take)(input, {
1121
1197
  content: /* @__PURE__ */ __name((_) => se_GuardrailContentBlockList(_, context), "content"),
1198
+ outputScope: [],
1122
1199
  source: []
1123
1200
  })
1124
1201
  );
@@ -1203,6 +1280,20 @@ var se_InvokeModelCommand = /* @__PURE__ */ __name(async (input, context) => {
1203
1280
  b.m("POST").h(headers).b(body);
1204
1281
  return b.build();
1205
1282
  }, "se_InvokeModelCommand");
1283
+ var se_InvokeModelWithBidirectionalStreamCommand = /* @__PURE__ */ __name(async (input, context) => {
1284
+ const b = (0, import_core.requestBuilder)(input, context);
1285
+ const headers = {
1286
+ "content-type": "application/json"
1287
+ };
1288
+ b.bp("/model/{modelId}/invoke-with-bidirectional-stream");
1289
+ b.p("modelId", () => input.modelId, "{modelId}", false);
1290
+ let body;
1291
+ if (input.body !== void 0) {
1292
+ body = se_InvokeModelWithBidirectionalStreamInput(input.body, context);
1293
+ }
1294
+ b.m("POST").h(headers).b(body);
1295
+ return b.build();
1296
+ }, "se_InvokeModelWithBidirectionalStreamCommand");
1206
1297
  var se_InvokeModelWithResponseStreamCommand = /* @__PURE__ */ __name(async (input, context) => {
1207
1298
  const b = (0, import_core.requestBuilder)(input, context);
1208
1299
  const headers = (0, import_smithy_client.map)({}, import_smithy_client.isSerializableHeaderValue, {
@@ -1268,6 +1359,7 @@ var de_ApplyGuardrailCommand = /* @__PURE__ */ __name(async (output, context) =>
1268
1359
  const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
1269
1360
  const doc = (0, import_smithy_client.take)(data, {
1270
1361
  action: import_smithy_client.expectString,
1362
+ actionReason: import_smithy_client.expectString,
1271
1363
  assessments: /* @__PURE__ */ __name((_) => de_GuardrailAssessmentList(_, context), "assessments"),
1272
1364
  guardrailCoverage: import_smithy_client._json,
1273
1365
  outputs: import_smithy_client._json,
@@ -1342,6 +1434,17 @@ var de_InvokeModelCommand = /* @__PURE__ */ __name(async (output, context) => {
1342
1434
  contents.body = data;
1343
1435
  return contents;
1344
1436
  }, "de_InvokeModelCommand");
1437
+ var de_InvokeModelWithBidirectionalStreamCommand = /* @__PURE__ */ __name(async (output, context) => {
1438
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1439
+ return de_CommandError(output, context);
1440
+ }
1441
+ const contents = (0, import_smithy_client.map)({
1442
+ $metadata: deserializeMetadata(output)
1443
+ });
1444
+ const data = output.body;
1445
+ contents.body = de_InvokeModelWithBidirectionalStreamOutput(data, context);
1446
+ return contents;
1447
+ }, "de_InvokeModelWithBidirectionalStreamCommand");
1345
1448
  var de_InvokeModelWithResponseStreamCommand = /* @__PURE__ */ __name(async (output, context) => {
1346
1449
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1347
1450
  return de_CommandError(output, context);
@@ -1597,6 +1700,24 @@ var de_ValidationExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, cont
1597
1700
  });
1598
1701
  return (0, import_smithy_client.decorateServiceException)(exception, parsedOutput.body);
1599
1702
  }, "de_ValidationExceptionRes");
1703
+ var se_InvokeModelWithBidirectionalStreamInput = /* @__PURE__ */ __name((input, context) => {
1704
+ const eventMarshallingVisitor = /* @__PURE__ */ __name((event) => InvokeModelWithBidirectionalStreamInput.visit(event, {
1705
+ chunk: /* @__PURE__ */ __name((value) => se_BidirectionalInputPayloadPart_event(value, context), "chunk"),
1706
+ _: /* @__PURE__ */ __name((value) => value, "_")
1707
+ }), "eventMarshallingVisitor");
1708
+ return context.eventStreamMarshaller.serialize(input, eventMarshallingVisitor);
1709
+ }, "se_InvokeModelWithBidirectionalStreamInput");
1710
+ var se_BidirectionalInputPayloadPart_event = /* @__PURE__ */ __name((input, context) => {
1711
+ const headers = {
1712
+ ":event-type": { type: "string", value: "chunk" },
1713
+ ":message-type": { type: "string", value: "event" },
1714
+ ":content-type": { type: "string", value: "application/json" }
1715
+ };
1716
+ let body = new Uint8Array();
1717
+ body = se_BidirectionalInputPayloadPart(input, context);
1718
+ body = context.utf8Decoder(JSON.stringify(body));
1719
+ return { headers, body };
1720
+ }, "se_BidirectionalInputPayloadPart_event");
1600
1721
  var de_ConverseStreamOutput = /* @__PURE__ */ __name((output, context) => {
1601
1722
  return context.eventStreamMarshaller.deserialize(output, async (event) => {
1602
1723
  if (event["messageStart"] != null) {
@@ -1663,6 +1784,52 @@ var de_ConverseStreamOutput = /* @__PURE__ */ __name((output, context) => {
1663
1784
  return { $unknown: output };
1664
1785
  });
1665
1786
  }, "de_ConverseStreamOutput");
1787
+ var de_InvokeModelWithBidirectionalStreamOutput = /* @__PURE__ */ __name((output, context) => {
1788
+ return context.eventStreamMarshaller.deserialize(output, async (event) => {
1789
+ if (event["chunk"] != null) {
1790
+ return {
1791
+ chunk: await de_BidirectionalOutputPayloadPart_event(event["chunk"], context)
1792
+ };
1793
+ }
1794
+ if (event["internalServerException"] != null) {
1795
+ return {
1796
+ internalServerException: await de_InternalServerException_event(event["internalServerException"], context)
1797
+ };
1798
+ }
1799
+ if (event["modelStreamErrorException"] != null) {
1800
+ return {
1801
+ modelStreamErrorException: await de_ModelStreamErrorException_event(
1802
+ event["modelStreamErrorException"],
1803
+ context
1804
+ )
1805
+ };
1806
+ }
1807
+ if (event["validationException"] != null) {
1808
+ return {
1809
+ validationException: await de_ValidationException_event(event["validationException"], context)
1810
+ };
1811
+ }
1812
+ if (event["throttlingException"] != null) {
1813
+ return {
1814
+ throttlingException: await de_ThrottlingException_event(event["throttlingException"], context)
1815
+ };
1816
+ }
1817
+ if (event["modelTimeoutException"] != null) {
1818
+ return {
1819
+ modelTimeoutException: await de_ModelTimeoutException_event(event["modelTimeoutException"], context)
1820
+ };
1821
+ }
1822
+ if (event["serviceUnavailableException"] != null) {
1823
+ return {
1824
+ serviceUnavailableException: await de_ServiceUnavailableException_event(
1825
+ event["serviceUnavailableException"],
1826
+ context
1827
+ )
1828
+ };
1829
+ }
1830
+ return { $unknown: output };
1831
+ });
1832
+ }, "de_InvokeModelWithBidirectionalStreamOutput");
1666
1833
  var de_ResponseStream = /* @__PURE__ */ __name((output, context) => {
1667
1834
  return context.eventStreamMarshaller.deserialize(output, async (event) => {
1668
1835
  if (event["chunk"] != null) {
@@ -1709,6 +1876,12 @@ var de_ResponseStream = /* @__PURE__ */ __name((output, context) => {
1709
1876
  return { $unknown: output };
1710
1877
  });
1711
1878
  }, "de_ResponseStream");
1879
+ var de_BidirectionalOutputPayloadPart_event = /* @__PURE__ */ __name(async (output, context) => {
1880
+ const contents = {};
1881
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
1882
+ Object.assign(contents, de_BidirectionalOutputPayloadPart(data, context));
1883
+ return contents;
1884
+ }, "de_BidirectionalOutputPayloadPart_event");
1712
1885
  var de_ContentBlockDeltaEvent_event = /* @__PURE__ */ __name(async (output, context) => {
1713
1886
  const contents = {};
1714
1887
  const data = await (0, import_core2.parseJsonBody)(output.body, context);
@@ -1793,6 +1966,11 @@ var de_ValidationException_event = /* @__PURE__ */ __name(async (output, context
1793
1966
  };
1794
1967
  return de_ValidationExceptionRes(parsedOutput, context);
1795
1968
  }, "de_ValidationException_event");
1969
+ var se_BidirectionalInputPayloadPart = /* @__PURE__ */ __name((input, context) => {
1970
+ return (0, import_smithy_client.take)(input, {
1971
+ bytes: context.base64Encoder
1972
+ });
1973
+ }, "se_BidirectionalInputPayloadPart");
1796
1974
  var se_ContentBlock = /* @__PURE__ */ __name((input, context) => {
1797
1975
  return ContentBlock.visit(input, {
1798
1976
  cachePoint: /* @__PURE__ */ __name((value) => ({ cachePoint: (0, import_smithy_client._json)(value) }), "cachePoint"),
@@ -2017,6 +2195,11 @@ var de_AsyncInvokeSummary = /* @__PURE__ */ __name((output, context) => {
2017
2195
  submitTime: /* @__PURE__ */ __name((_) => (0, import_smithy_client.expectNonNull)((0, import_smithy_client.parseRfc3339DateTimeWithOffset)(_)), "submitTime")
2018
2196
  });
2019
2197
  }, "de_AsyncInvokeSummary");
2198
+ var de_BidirectionalOutputPayloadPart = /* @__PURE__ */ __name((output, context) => {
2199
+ return (0, import_smithy_client.take)(output, {
2200
+ bytes: context.base64Decoder
2201
+ });
2202
+ }, "de_BidirectionalOutputPayloadPart");
2020
2203
  var de_ContentBlock = /* @__PURE__ */ __name((output, context) => {
2021
2204
  if (output.cachePoint != null) {
2022
2205
  return {
@@ -2171,6 +2354,7 @@ var de_GuardrailAssessmentMap = /* @__PURE__ */ __name((output, context) => {
2171
2354
  var de_GuardrailContextualGroundingFilter = /* @__PURE__ */ __name((output, context) => {
2172
2355
  return (0, import_smithy_client.take)(output, {
2173
2356
  action: import_smithy_client.expectString,
2357
+ detected: import_smithy_client.expectBoolean,
2174
2358
  score: import_smithy_client.limitedParseDouble,
2175
2359
  threshold: import_smithy_client.limitedParseDouble,
2176
2360
  type: import_smithy_client.expectString
@@ -2216,6 +2400,7 @@ var de_GuardrailConverseImageSource = /* @__PURE__ */ __name((output, context) =
2216
2400
  }, "de_GuardrailConverseImageSource");
2217
2401
  var de_GuardrailTraceAssessment = /* @__PURE__ */ __name((output, context) => {
2218
2402
  return (0, import_smithy_client.take)(output, {
2403
+ actionReason: import_smithy_client.expectString,
2219
2404
  inputAssessment: /* @__PURE__ */ __name((_) => de_GuardrailAssessmentMap(_, context), "inputAssessment"),
2220
2405
  modelOutput: import_smithy_client._json,
2221
2406
  outputAssessments: /* @__PURE__ */ __name((_) => de_GuardrailAssessmentListMap(_, context), "outputAssessments")
@@ -2453,6 +2638,34 @@ var InvokeModelCommand = class extends import_smithy_client.Command.classBuilder
2453
2638
  }
2454
2639
  };
2455
2640
 
2641
+ // src/commands/InvokeModelWithBidirectionalStreamCommand.ts
2642
+
2643
+
2644
+
2645
+
2646
+ var InvokeModelWithBidirectionalStreamCommand = class extends import_smithy_client.Command.classBuilder().ep(commonParams).m(function(Command, cs, config, o) {
2647
+ return [
2648
+ (0, import_middleware_serde.getSerdePlugin)(config, this.serialize, this.deserialize),
2649
+ (0, import_middleware_endpoint.getEndpointPlugin)(config, Command.getEndpointParameterInstructions()),
2650
+ (0, import_middleware_eventstream.getEventStreamPlugin)(config)
2651
+ ];
2652
+ }).s("AmazonBedrockFrontendService", "InvokeModelWithBidirectionalStream", {
2653
+ /**
2654
+ * @internal
2655
+ */
2656
+ eventStream: {
2657
+ input: true,
2658
+ output: true
2659
+ }
2660
+ }).n("BedrockRuntimeClient", "InvokeModelWithBidirectionalStreamCommand").f(
2661
+ InvokeModelWithBidirectionalStreamRequestFilterSensitiveLog,
2662
+ InvokeModelWithBidirectionalStreamResponseFilterSensitiveLog
2663
+ ).ser(se_InvokeModelWithBidirectionalStreamCommand).de(de_InvokeModelWithBidirectionalStreamCommand).build() {
2664
+ static {
2665
+ __name(this, "InvokeModelWithBidirectionalStreamCommand");
2666
+ }
2667
+ };
2668
+
2456
2669
  // src/commands/InvokeModelWithResponseStreamCommand.ts
2457
2670
 
2458
2671
 
@@ -2512,6 +2725,7 @@ var commands = {
2512
2725
  ConverseStreamCommand,
2513
2726
  GetAsyncInvokeCommand,
2514
2727
  InvokeModelCommand,
2728
+ InvokeModelWithBidirectionalStreamCommand,
2515
2729
  InvokeModelWithResponseStreamCommand,
2516
2730
  ListAsyncInvokesCommand,
2517
2731
  StartAsyncInvokeCommand
@@ -2539,6 +2753,7 @@ var paginateListAsyncInvokes = (0, import_core.createPaginator)(BedrockRuntimeCl
2539
2753
  ConverseStreamCommand,
2540
2754
  GetAsyncInvokeCommand,
2541
2755
  InvokeModelCommand,
2756
+ InvokeModelWithBidirectionalStreamCommand,
2542
2757
  InvokeModelWithResponseStreamCommand,
2543
2758
  ListAsyncInvokesCommand,
2544
2759
  StartAsyncInvokeCommand,
@@ -2559,6 +2774,7 @@ var paginateListAsyncInvokes = (0, import_core.createPaginator)(BedrockRuntimeCl
2559
2774
  GuardrailImageSource,
2560
2775
  GuardrailContentQualifier,
2561
2776
  GuardrailContentBlock,
2777
+ GuardrailOutputScope,
2562
2778
  GuardrailContentSource,
2563
2779
  GuardrailAction,
2564
2780
  GuardrailContentPolicyAction,
@@ -2608,6 +2824,8 @@ var paginateListAsyncInvokes = (0, import_core.createPaginator)(BedrockRuntimeCl
2608
2824
  ModelStreamErrorException,
2609
2825
  ConverseStreamOutput,
2610
2826
  Trace,
2827
+ InvokeModelWithBidirectionalStreamInput,
2828
+ InvokeModelWithBidirectionalStreamOutput,
2611
2829
  ResponseStream,
2612
2830
  GetAsyncInvokeResponseFilterSensitiveLog,
2613
2831
  AsyncInvokeSummaryFilterSensitiveLog,
@@ -2636,6 +2854,12 @@ var paginateListAsyncInvokes = (0, import_core.createPaginator)(BedrockRuntimeCl
2636
2854
  ConverseStreamResponseFilterSensitiveLog,
2637
2855
  InvokeModelRequestFilterSensitiveLog,
2638
2856
  InvokeModelResponseFilterSensitiveLog,
2857
+ BidirectionalInputPayloadPartFilterSensitiveLog,
2858
+ InvokeModelWithBidirectionalStreamInputFilterSensitiveLog,
2859
+ InvokeModelWithBidirectionalStreamRequestFilterSensitiveLog,
2860
+ BidirectionalOutputPayloadPartFilterSensitiveLog,
2861
+ InvokeModelWithBidirectionalStreamOutputFilterSensitiveLog,
2862
+ InvokeModelWithBidirectionalStreamResponseFilterSensitiveLog,
2639
2863
  InvokeModelWithResponseStreamRequestFilterSensitiveLog,
2640
2864
  PayloadPartFilterSensitiveLog,
2641
2865
  ResponseStreamFilterSensitiveLog,
@@ -27,6 +27,8 @@ const getRuntimeConfig = (config) => {
27
27
  credentialDefaultProvider: config?.credentialDefaultProvider ?? ((_) => () => Promise.reject(new Error("Credential is missing"))),
28
28
  defaultUserAgentProvider: config?.defaultUserAgentProvider ??
29
29
  (0, util_user_agent_browser_1.createDefaultUserAgentProvider)({ serviceId: clientSharedValues.serviceId, clientVersion: package_json_1.default.version }),
30
+ eventStreamPayloadHandlerProvider: config?.eventStreamPayloadHandlerProvider ??
31
+ (() => ({ handle: (0, invalid_dependency_1.invalidFunction)("event stream request is not supported in browser.") })),
30
32
  eventStreamSerdeProvider: config?.eventStreamSerdeProvider ?? eventstream_serde_browser_1.eventStreamSerdeProvider,
31
33
  maxAttempts: config?.maxAttempts ?? util_retry_1.DEFAULT_MAX_ATTEMPTS,
32
34
  region: config?.region ?? (0, invalid_dependency_1.invalidProvider)("Region is missing"),
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
5
5
  const package_json_1 = tslib_1.__importDefault(require("../package.json"));
6
6
  const core_1 = require("@aws-sdk/core");
7
7
  const credential_provider_node_1 = require("@aws-sdk/credential-provider-node");
8
+ const eventstream_handler_node_1 = require("@aws-sdk/eventstream-handler-node");
8
9
  const util_user_agent_node_1 = require("@aws-sdk/util-user-agent-node");
9
10
  const config_resolver_1 = require("@smithy/config-resolver");
10
11
  const eventstream_serde_node_1 = require("@smithy/eventstream-serde-node");
@@ -34,6 +35,7 @@ const getRuntimeConfig = (config) => {
34
35
  credentialDefaultProvider: config?.credentialDefaultProvider ?? credential_provider_node_1.defaultProvider,
35
36
  defaultUserAgentProvider: config?.defaultUserAgentProvider ??
36
37
  (0, util_user_agent_node_1.createDefaultUserAgentProvider)({ serviceId: clientSharedValues.serviceId, clientVersion: package_json_1.default.version }),
38
+ eventStreamPayloadHandlerProvider: config?.eventStreamPayloadHandlerProvider ?? eventstream_handler_node_1.eventStreamPayloadHandlerProvider,
37
39
  eventStreamSerdeProvider: config?.eventStreamSerdeProvider ?? eventstream_serde_node_1.eventStreamSerdeProvider,
38
40
  maxAttempts: config?.maxAttempts ?? (0, node_config_provider_1.loadConfig)(middleware_retry_1.NODE_MAX_ATTEMPT_CONFIG_OPTIONS, config),
39
41
  region: config?.region ??
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getRuntimeConfig = void 0;
4
4
  const sha256_js_1 = require("@aws-crypto/sha256-js");
5
+ const invalid_dependency_1 = require("@smithy/invalid-dependency");
5
6
  const runtimeConfig_browser_1 = require("./runtimeConfig.browser");
6
7
  const getRuntimeConfig = (config) => {
7
8
  const browserDefaults = (0, runtimeConfig_browser_1.getRuntimeConfig)(config);
@@ -9,6 +10,8 @@ const getRuntimeConfig = (config) => {
9
10
  ...browserDefaults,
10
11
  ...config,
11
12
  runtime: "react-native",
13
+ eventStreamPayloadHandlerProvider: config?.eventStreamPayloadHandlerProvider ??
14
+ (() => ({ handle: (0, invalid_dependency_1.invalidFunction)("event stream request is not supported in ReactNative.") })),
12
15
  sha256: config?.sha256 ?? sha256_js_1.Sha256,
13
16
  };
14
17
  };
@@ -5,6 +5,7 @@ import { ConverseCommand } from "./commands/ConverseCommand";
5
5
  import { ConverseStreamCommand, } from "./commands/ConverseStreamCommand";
6
6
  import { GetAsyncInvokeCommand, } from "./commands/GetAsyncInvokeCommand";
7
7
  import { InvokeModelCommand } from "./commands/InvokeModelCommand";
8
+ import { InvokeModelWithBidirectionalStreamCommand, } from "./commands/InvokeModelWithBidirectionalStreamCommand";
8
9
  import { InvokeModelWithResponseStreamCommand, } from "./commands/InvokeModelWithResponseStreamCommand";
9
10
  import { ListAsyncInvokesCommand, } from "./commands/ListAsyncInvokesCommand";
10
11
  import { StartAsyncInvokeCommand, } from "./commands/StartAsyncInvokeCommand";
@@ -14,6 +15,7 @@ const commands = {
14
15
  ConverseStreamCommand,
15
16
  GetAsyncInvokeCommand,
16
17
  InvokeModelCommand,
18
+ InvokeModelWithBidirectionalStreamCommand,
17
19
  InvokeModelWithResponseStreamCommand,
18
20
  ListAsyncInvokesCommand,
19
21
  StartAsyncInvokeCommand,
@@ -1,3 +1,4 @@
1
+ import { resolveEventStreamConfig, } from "@aws-sdk/middleware-eventstream";
1
2
  import { getHostHeaderPlugin, resolveHostHeaderConfig, } from "@aws-sdk/middleware-host-header";
2
3
  import { getLoggerPlugin } from "@aws-sdk/middleware-logger";
3
4
  import { getRecursionDetectionPlugin } from "@aws-sdk/middleware-recursion-detection";
@@ -28,8 +29,9 @@ export class BedrockRuntimeClient extends __Client {
28
29
  const _config_6 = resolveEndpointConfig(_config_5);
29
30
  const _config_7 = resolveEventStreamSerdeConfig(_config_6);
30
31
  const _config_8 = resolveHttpAuthSchemeConfig(_config_7);
31
- const _config_9 = resolveRuntimeExtensions(_config_8, configuration?.extensions || []);
32
- this.config = _config_9;
32
+ const _config_9 = resolveEventStreamConfig(_config_8);
33
+ const _config_10 = resolveRuntimeExtensions(_config_9, configuration?.extensions || []);
34
+ this.config = _config_10;
33
35
  this.middlewareStack.use(getUserAgentPlugin(this.config));
34
36
  this.middlewareStack.use(getRetryPlugin(this.config));
35
37
  this.middlewareStack.use(getContentLengthPlugin(this.config));
@@ -0,0 +1,30 @@
1
+ import { getEventStreamPlugin } from "@aws-sdk/middleware-eventstream";
2
+ import { getEndpointPlugin } from "@smithy/middleware-endpoint";
3
+ import { getSerdePlugin } from "@smithy/middleware-serde";
4
+ import { Command as $Command } from "@smithy/smithy-client";
5
+ import { commonParams } from "../endpoint/EndpointParameters";
6
+ import { InvokeModelWithBidirectionalStreamRequestFilterSensitiveLog, InvokeModelWithBidirectionalStreamResponseFilterSensitiveLog, } from "../models/models_0";
7
+ import { de_InvokeModelWithBidirectionalStreamCommand, se_InvokeModelWithBidirectionalStreamCommand, } from "../protocols/Aws_restJson1";
8
+ export { $Command };
9
+ export class InvokeModelWithBidirectionalStreamCommand extends $Command
10
+ .classBuilder()
11
+ .ep(commonParams)
12
+ .m(function (Command, cs, config, o) {
13
+ return [
14
+ getSerdePlugin(config, this.serialize, this.deserialize),
15
+ getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
16
+ getEventStreamPlugin(config),
17
+ ];
18
+ })
19
+ .s("AmazonBedrockFrontendService", "InvokeModelWithBidirectionalStream", {
20
+ eventStream: {
21
+ input: true,
22
+ output: true,
23
+ },
24
+ })
25
+ .n("BedrockRuntimeClient", "InvokeModelWithBidirectionalStreamCommand")
26
+ .f(InvokeModelWithBidirectionalStreamRequestFilterSensitiveLog, InvokeModelWithBidirectionalStreamResponseFilterSensitiveLog)
27
+ .ser(se_InvokeModelWithBidirectionalStreamCommand)
28
+ .de(de_InvokeModelWithBidirectionalStreamCommand)
29
+ .build() {
30
+ }
@@ -3,6 +3,7 @@ export * from "./ConverseCommand";
3
3
  export * from "./ConverseStreamCommand";
4
4
  export * from "./GetAsyncInvokeCommand";
5
5
  export * from "./InvokeModelCommand";
6
+ export * from "./InvokeModelWithBidirectionalStreamCommand";
6
7
  export * from "./InvokeModelWithResponseStreamCommand";
7
8
  export * from "./ListAsyncInvokesCommand";
8
9
  export * from "./StartAsyncInvokeCommand";