@aws-sdk/client-bedrock-runtime 3.784.0 → 3.787.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 (33) hide show
  1. package/README.md +8 -0
  2. package/dist-cjs/index.js +210 -2
  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 +68 -0
  11. package/dist-es/protocols/Aws_restJson1.js +100 -1
  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/InvokeModelWithBidirectionalStreamCommand.d.ts +144 -0
  18. package/dist-types/commands/index.d.ts +1 -0
  19. package/dist-types/models/models_0.d.ts +233 -0
  20. package/dist-types/protocols/Aws_restJson1.d.ts +9 -0
  21. package/dist-types/runtimeConfig.browser.d.ts +1 -0
  22. package/dist-types/runtimeConfig.d.ts +1 -0
  23. package/dist-types/runtimeConfig.native.d.ts +1 -0
  24. package/dist-types/ts3.4/BedrockRuntime.d.ts +23 -0
  25. package/dist-types/ts3.4/BedrockRuntimeClient.d.ts +14 -0
  26. package/dist-types/ts3.4/commands/InvokeModelWithBidirectionalStreamCommand.d.ts +51 -0
  27. package/dist-types/ts3.4/commands/index.d.ts +1 -0
  28. package/dist-types/ts3.4/models/models_0.d.ts +157 -0
  29. package/dist-types/ts3.4/protocols/Aws_restJson1.d.ts +12 -0
  30. package/dist-types/ts3.4/runtimeConfig.browser.d.ts +1 -0
  31. package/dist-types/ts3.4/runtimeConfig.d.ts +1 -0
  32. package/dist-types/ts3.4/runtimeConfig.native.d.ts +1 -0
  33. package/package.json +7 -5
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,
@@ -90,6 +92,13 @@ __export(index_exports, {
90
92
  InvokeModelCommand: () => InvokeModelCommand,
91
93
  InvokeModelRequestFilterSensitiveLog: () => InvokeModelRequestFilterSensitiveLog,
92
94
  InvokeModelResponseFilterSensitiveLog: () => InvokeModelResponseFilterSensitiveLog,
95
+ InvokeModelWithBidirectionalStreamCommand: () => InvokeModelWithBidirectionalStreamCommand,
96
+ InvokeModelWithBidirectionalStreamInput: () => InvokeModelWithBidirectionalStreamInput,
97
+ InvokeModelWithBidirectionalStreamInputFilterSensitiveLog: () => InvokeModelWithBidirectionalStreamInputFilterSensitiveLog,
98
+ InvokeModelWithBidirectionalStreamOutput: () => InvokeModelWithBidirectionalStreamOutput,
99
+ InvokeModelWithBidirectionalStreamOutputFilterSensitiveLog: () => InvokeModelWithBidirectionalStreamOutputFilterSensitiveLog,
100
+ InvokeModelWithBidirectionalStreamRequestFilterSensitiveLog: () => InvokeModelWithBidirectionalStreamRequestFilterSensitiveLog,
101
+ InvokeModelWithBidirectionalStreamResponseFilterSensitiveLog: () => InvokeModelWithBidirectionalStreamResponseFilterSensitiveLog,
93
102
  InvokeModelWithResponseStreamCommand: () => InvokeModelWithResponseStreamCommand,
94
103
  InvokeModelWithResponseStreamRequestFilterSensitiveLog: () => InvokeModelWithResponseStreamRequestFilterSensitiveLog,
95
104
  InvokeModelWithResponseStreamResponseFilterSensitiveLog: () => InvokeModelWithResponseStreamResponseFilterSensitiveLog,
@@ -136,6 +145,7 @@ __export(index_exports, {
136
145
  module.exports = __toCommonJS(index_exports);
137
146
 
138
147
  // src/BedrockRuntimeClient.ts
148
+ var import_middleware_eventstream = require("@aws-sdk/middleware-eventstream");
139
149
  var import_middleware_host_header = require("@aws-sdk/middleware-host-header");
140
150
  var import_middleware_logger = require("@aws-sdk/middleware-logger");
141
151
  var import_middleware_recursion_detection = require("@aws-sdk/middleware-recursion-detection");
@@ -250,8 +260,9 @@ var BedrockRuntimeClient = class extends import_smithy_client.Client {
250
260
  const _config_6 = (0, import_middleware_endpoint.resolveEndpointConfig)(_config_5);
251
261
  const _config_7 = (0, import_eventstream_serde_config_resolver.resolveEventStreamSerdeConfig)(_config_6);
252
262
  const _config_8 = (0, import_httpAuthSchemeProvider.resolveHttpAuthSchemeConfig)(_config_7);
253
- const _config_9 = resolveRuntimeExtensions(_config_8, configuration?.extensions || []);
254
- 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;
255
266
  this.middlewareStack.use((0, import_middleware_user_agent.getUserAgentPlugin)(this.config));
256
267
  this.middlewareStack.use((0, import_middleware_retry.getRetryPlugin)(this.config));
257
268
  this.middlewareStack.use((0, import_middleware_content_length.getContentLengthPlugin)(this.config));
@@ -922,6 +933,29 @@ var Trace = {
922
933
  ENABLED: "ENABLED",
923
934
  ENABLED_FULL: "ENABLED_FULL"
924
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 = {}));
925
959
  var ResponseStream;
926
960
  ((ResponseStream3) => {
927
961
  ResponseStream3.visit = /* @__PURE__ */ __name((value, visitor) => {
@@ -1089,6 +1123,37 @@ var InvokeModelResponseFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({
1089
1123
  ...obj,
1090
1124
  ...obj.body && { body: import_smithy_client.SENSITIVE_STRING }
1091
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");
1092
1157
  var InvokeModelWithResponseStreamRequestFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({
1093
1158
  ...obj,
1094
1159
  ...obj.body && { body: import_smithy_client.SENSITIVE_STRING }
@@ -1215,6 +1280,20 @@ var se_InvokeModelCommand = /* @__PURE__ */ __name(async (input, context) => {
1215
1280
  b.m("POST").h(headers).b(body);
1216
1281
  return b.build();
1217
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");
1218
1297
  var se_InvokeModelWithResponseStreamCommand = /* @__PURE__ */ __name(async (input, context) => {
1219
1298
  const b = (0, import_core.requestBuilder)(input, context);
1220
1299
  const headers = (0, import_smithy_client.map)({}, import_smithy_client.isSerializableHeaderValue, {
@@ -1355,6 +1434,17 @@ var de_InvokeModelCommand = /* @__PURE__ */ __name(async (output, context) => {
1355
1434
  contents.body = data;
1356
1435
  return contents;
1357
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");
1358
1448
  var de_InvokeModelWithResponseStreamCommand = /* @__PURE__ */ __name(async (output, context) => {
1359
1449
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1360
1450
  return de_CommandError(output, context);
@@ -1610,6 +1700,24 @@ var de_ValidationExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, cont
1610
1700
  });
1611
1701
  return (0, import_smithy_client.decorateServiceException)(exception, parsedOutput.body);
1612
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");
1613
1721
  var de_ConverseStreamOutput = /* @__PURE__ */ __name((output, context) => {
1614
1722
  return context.eventStreamMarshaller.deserialize(output, async (event) => {
1615
1723
  if (event["messageStart"] != null) {
@@ -1676,6 +1784,52 @@ var de_ConverseStreamOutput = /* @__PURE__ */ __name((output, context) => {
1676
1784
  return { $unknown: output };
1677
1785
  });
1678
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");
1679
1833
  var de_ResponseStream = /* @__PURE__ */ __name((output, context) => {
1680
1834
  return context.eventStreamMarshaller.deserialize(output, async (event) => {
1681
1835
  if (event["chunk"] != null) {
@@ -1722,6 +1876,12 @@ var de_ResponseStream = /* @__PURE__ */ __name((output, context) => {
1722
1876
  return { $unknown: output };
1723
1877
  });
1724
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");
1725
1885
  var de_ContentBlockDeltaEvent_event = /* @__PURE__ */ __name(async (output, context) => {
1726
1886
  const contents = {};
1727
1887
  const data = await (0, import_core2.parseJsonBody)(output.body, context);
@@ -1806,6 +1966,11 @@ var de_ValidationException_event = /* @__PURE__ */ __name(async (output, context
1806
1966
  };
1807
1967
  return de_ValidationExceptionRes(parsedOutput, context);
1808
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");
1809
1974
  var se_ContentBlock = /* @__PURE__ */ __name((input, context) => {
1810
1975
  return ContentBlock.visit(input, {
1811
1976
  cachePoint: /* @__PURE__ */ __name((value) => ({ cachePoint: (0, import_smithy_client._json)(value) }), "cachePoint"),
@@ -2030,6 +2195,11 @@ var de_AsyncInvokeSummary = /* @__PURE__ */ __name((output, context) => {
2030
2195
  submitTime: /* @__PURE__ */ __name((_) => (0, import_smithy_client.expectNonNull)((0, import_smithy_client.parseRfc3339DateTimeWithOffset)(_)), "submitTime")
2031
2196
  });
2032
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");
2033
2203
  var de_ContentBlock = /* @__PURE__ */ __name((output, context) => {
2034
2204
  if (output.cachePoint != null) {
2035
2205
  return {
@@ -2468,6 +2638,34 @@ var InvokeModelCommand = class extends import_smithy_client.Command.classBuilder
2468
2638
  }
2469
2639
  };
2470
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
+
2471
2669
  // src/commands/InvokeModelWithResponseStreamCommand.ts
2472
2670
 
2473
2671
 
@@ -2527,6 +2725,7 @@ var commands = {
2527
2725
  ConverseStreamCommand,
2528
2726
  GetAsyncInvokeCommand,
2529
2727
  InvokeModelCommand,
2728
+ InvokeModelWithBidirectionalStreamCommand,
2530
2729
  InvokeModelWithResponseStreamCommand,
2531
2730
  ListAsyncInvokesCommand,
2532
2731
  StartAsyncInvokeCommand
@@ -2554,6 +2753,7 @@ var paginateListAsyncInvokes = (0, import_core.createPaginator)(BedrockRuntimeCl
2554
2753
  ConverseStreamCommand,
2555
2754
  GetAsyncInvokeCommand,
2556
2755
  InvokeModelCommand,
2756
+ InvokeModelWithBidirectionalStreamCommand,
2557
2757
  InvokeModelWithResponseStreamCommand,
2558
2758
  ListAsyncInvokesCommand,
2559
2759
  StartAsyncInvokeCommand,
@@ -2624,6 +2824,8 @@ var paginateListAsyncInvokes = (0, import_core.createPaginator)(BedrockRuntimeCl
2624
2824
  ModelStreamErrorException,
2625
2825
  ConverseStreamOutput,
2626
2826
  Trace,
2827
+ InvokeModelWithBidirectionalStreamInput,
2828
+ InvokeModelWithBidirectionalStreamOutput,
2627
2829
  ResponseStream,
2628
2830
  GetAsyncInvokeResponseFilterSensitiveLog,
2629
2831
  AsyncInvokeSummaryFilterSensitiveLog,
@@ -2652,6 +2854,12 @@ var paginateListAsyncInvokes = (0, import_core.createPaginator)(BedrockRuntimeCl
2652
2854
  ConverseStreamResponseFilterSensitiveLog,
2653
2855
  InvokeModelRequestFilterSensitiveLog,
2654
2856
  InvokeModelResponseFilterSensitiveLog,
2857
+ BidirectionalInputPayloadPartFilterSensitiveLog,
2858
+ InvokeModelWithBidirectionalStreamInputFilterSensitiveLog,
2859
+ InvokeModelWithBidirectionalStreamRequestFilterSensitiveLog,
2860
+ BidirectionalOutputPayloadPartFilterSensitiveLog,
2861
+ InvokeModelWithBidirectionalStreamOutputFilterSensitiveLog,
2862
+ InvokeModelWithBidirectionalStreamResponseFilterSensitiveLog,
2655
2863
  InvokeModelWithResponseStreamRequestFilterSensitiveLog,
2656
2864
  PayloadPartFilterSensitiveLog,
2657
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";
@@ -582,6 +582,34 @@ export const Trace = {
582
582
  ENABLED: "ENABLED",
583
583
  ENABLED_FULL: "ENABLED_FULL",
584
584
  };
585
+ export var InvokeModelWithBidirectionalStreamInput;
586
+ (function (InvokeModelWithBidirectionalStreamInput) {
587
+ InvokeModelWithBidirectionalStreamInput.visit = (value, visitor) => {
588
+ if (value.chunk !== undefined)
589
+ return visitor.chunk(value.chunk);
590
+ return visitor._(value.$unknown[0], value.$unknown[1]);
591
+ };
592
+ })(InvokeModelWithBidirectionalStreamInput || (InvokeModelWithBidirectionalStreamInput = {}));
593
+ export var InvokeModelWithBidirectionalStreamOutput;
594
+ (function (InvokeModelWithBidirectionalStreamOutput) {
595
+ InvokeModelWithBidirectionalStreamOutput.visit = (value, visitor) => {
596
+ if (value.chunk !== undefined)
597
+ return visitor.chunk(value.chunk);
598
+ if (value.internalServerException !== undefined)
599
+ return visitor.internalServerException(value.internalServerException);
600
+ if (value.modelStreamErrorException !== undefined)
601
+ return visitor.modelStreamErrorException(value.modelStreamErrorException);
602
+ if (value.validationException !== undefined)
603
+ return visitor.validationException(value.validationException);
604
+ if (value.throttlingException !== undefined)
605
+ return visitor.throttlingException(value.throttlingException);
606
+ if (value.modelTimeoutException !== undefined)
607
+ return visitor.modelTimeoutException(value.modelTimeoutException);
608
+ if (value.serviceUnavailableException !== undefined)
609
+ return visitor.serviceUnavailableException(value.serviceUnavailableException);
610
+ return visitor._(value.$unknown[0], value.$unknown[1]);
611
+ };
612
+ })(InvokeModelWithBidirectionalStreamOutput || (InvokeModelWithBidirectionalStreamOutput = {}));
585
613
  export var ResponseStream;
586
614
  (function (ResponseStream) {
587
615
  ResponseStream.visit = (value, visitor) => {
@@ -798,6 +826,46 @@ export const InvokeModelResponseFilterSensitiveLog = (obj) => ({
798
826
  ...obj,
799
827
  ...(obj.body && { body: SENSITIVE_STRING }),
800
828
  });
829
+ export const BidirectionalInputPayloadPartFilterSensitiveLog = (obj) => ({
830
+ ...obj,
831
+ ...(obj.bytes && { bytes: SENSITIVE_STRING }),
832
+ });
833
+ export const InvokeModelWithBidirectionalStreamInputFilterSensitiveLog = (obj) => {
834
+ if (obj.chunk !== undefined)
835
+ return { chunk: SENSITIVE_STRING };
836
+ if (obj.$unknown !== undefined)
837
+ return { [obj.$unknown[0]]: "UNKNOWN" };
838
+ };
839
+ export const InvokeModelWithBidirectionalStreamRequestFilterSensitiveLog = (obj) => ({
840
+ ...obj,
841
+ ...(obj.body && { body: "STREAMING_CONTENT" }),
842
+ });
843
+ export const BidirectionalOutputPayloadPartFilterSensitiveLog = (obj) => ({
844
+ ...obj,
845
+ ...(obj.bytes && { bytes: SENSITIVE_STRING }),
846
+ });
847
+ export const InvokeModelWithBidirectionalStreamOutputFilterSensitiveLog = (obj) => {
848
+ if (obj.chunk !== undefined)
849
+ return { chunk: SENSITIVE_STRING };
850
+ if (obj.internalServerException !== undefined)
851
+ return { internalServerException: obj.internalServerException };
852
+ if (obj.modelStreamErrorException !== undefined)
853
+ return { modelStreamErrorException: obj.modelStreamErrorException };
854
+ if (obj.validationException !== undefined)
855
+ return { validationException: obj.validationException };
856
+ if (obj.throttlingException !== undefined)
857
+ return { throttlingException: obj.throttlingException };
858
+ if (obj.modelTimeoutException !== undefined)
859
+ return { modelTimeoutException: obj.modelTimeoutException };
860
+ if (obj.serviceUnavailableException !== undefined)
861
+ return { serviceUnavailableException: obj.serviceUnavailableException };
862
+ if (obj.$unknown !== undefined)
863
+ return { [obj.$unknown[0]]: "UNKNOWN" };
864
+ };
865
+ export const InvokeModelWithBidirectionalStreamResponseFilterSensitiveLog = (obj) => ({
866
+ ...obj,
867
+ ...(obj.body && { body: "STREAMING_CONTENT" }),
868
+ });
801
869
  export const InvokeModelWithResponseStreamRequestFilterSensitiveLog = (obj) => ({
802
870
  ...obj,
803
871
  ...(obj.body && { body: SENSITIVE_STRING }),