@aws-sdk/client-bedrock-agent-runtime 3.696.0 → 3.697.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -234,6 +234,14 @@ InvokeFlow
234
234
 
235
235
  [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock-agent-runtime/command/InvokeFlowCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-agent-runtime/Interface/InvokeFlowCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-agent-runtime/Interface/InvokeFlowCommandOutput/)
236
236
 
237
+ </details>
238
+ <details>
239
+ <summary>
240
+ OptimizePrompt
241
+ </summary>
242
+
243
+ [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock-agent-runtime/command/OptimizePromptCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-agent-runtime/Interface/OptimizePromptCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-agent-runtime/Interface/OptimizePromptCommandOutput/)
244
+
237
245
  </details>
238
246
  <details>
239
247
  <summary>
package/dist-cjs/index.js CHANGED
@@ -25,6 +25,7 @@ __export(src_exports, {
25
25
  ActionGroupInvocationInputFilterSensitiveLog: () => ActionGroupInvocationInputFilterSensitiveLog,
26
26
  ActionGroupInvocationOutputFilterSensitiveLog: () => ActionGroupInvocationOutputFilterSensitiveLog,
27
27
  ActionInvocationType: () => ActionInvocationType,
28
+ AnalyzePromptEventFilterSensitiveLog: () => AnalyzePromptEventFilterSensitiveLog,
28
29
  ApiInvocationInputFilterSensitiveLog: () => ApiInvocationInputFilterSensitiveLog,
29
30
  ApiResultFilterSensitiveLog: () => ApiResultFilterSensitiveLog,
30
31
  AttributionFilterSensitiveLog: () => AttributionFilterSensitiveLog,
@@ -99,6 +100,8 @@ __export(src_exports, {
99
100
  GuardrailWordPolicyAction: () => GuardrailWordPolicyAction,
100
101
  GuardrailWordPolicyAssessmentFilterSensitiveLog: () => GuardrailWordPolicyAssessmentFilterSensitiveLog,
101
102
  InputFileFilterSensitiveLog: () => InputFileFilterSensitiveLog,
103
+ InputPrompt: () => InputPrompt,
104
+ InputPromptFilterSensitiveLog: () => InputPromptFilterSensitiveLog,
102
105
  InternalServerException: () => InternalServerException,
103
106
  InvocationInputFilterSensitiveLog: () => InvocationInputFilterSensitiveLog,
104
107
  InvocationInputMember: () => InvocationInputMember,
@@ -126,6 +129,14 @@ __export(src_exports, {
126
129
  ModelInvocationInputFilterSensitiveLog: () => ModelInvocationInputFilterSensitiveLog,
127
130
  NodeType: () => NodeType,
128
131
  ObservationFilterSensitiveLog: () => ObservationFilterSensitiveLog,
132
+ OptimizePromptCommand: () => OptimizePromptCommand,
133
+ OptimizePromptRequestFilterSensitiveLog: () => OptimizePromptRequestFilterSensitiveLog,
134
+ OptimizePromptResponseFilterSensitiveLog: () => OptimizePromptResponseFilterSensitiveLog,
135
+ OptimizedPrompt: () => OptimizedPrompt,
136
+ OptimizedPromptEventFilterSensitiveLog: () => OptimizedPromptEventFilterSensitiveLog,
137
+ OptimizedPromptFilterSensitiveLog: () => OptimizedPromptFilterSensitiveLog,
138
+ OptimizedPromptStream: () => OptimizedPromptStream,
139
+ OptimizedPromptStreamFilterSensitiveLog: () => OptimizedPromptStreamFilterSensitiveLog,
129
140
  OrchestrationConfigurationFilterSensitiveLog: () => OrchestrationConfigurationFilterSensitiveLog,
130
141
  OrchestrationModelInvocationOutputFilterSensitiveLog: () => OrchestrationModelInvocationOutputFilterSensitiveLog,
131
142
  OrchestrationTrace: () => OrchestrationTrace,
@@ -171,6 +182,7 @@ __export(src_exports, {
171
182
  ServiceQuotaExceededException: () => ServiceQuotaExceededException,
172
183
  SessionStateFilterSensitiveLog: () => SessionStateFilterSensitiveLog,
173
184
  Source: () => Source,
185
+ TextPromptFilterSensitiveLog: () => TextPromptFilterSensitiveLog,
174
186
  TextResponsePartFilterSensitiveLog: () => TextResponsePartFilterSensitiveLog,
175
187
  ThrottlingException: () => ThrottlingException,
176
188
  Trace: () => Trace,
@@ -843,6 +855,44 @@ var Memory;
843
855
  return visitor._(value.$unknown[0], value.$unknown[1]);
844
856
  }, "visit");
845
857
  })(Memory || (Memory = {}));
858
+ var InputPrompt;
859
+ ((InputPrompt3) => {
860
+ InputPrompt3.visit = /* @__PURE__ */ __name((value, visitor) => {
861
+ if (value.textPrompt !== void 0)
862
+ return visitor.textPrompt(value.textPrompt);
863
+ return visitor._(value.$unknown[0], value.$unknown[1]);
864
+ }, "visit");
865
+ })(InputPrompt || (InputPrompt = {}));
866
+ var OptimizedPrompt;
867
+ ((OptimizedPrompt2) => {
868
+ OptimizedPrompt2.visit = /* @__PURE__ */ __name((value, visitor) => {
869
+ if (value.textPrompt !== void 0)
870
+ return visitor.textPrompt(value.textPrompt);
871
+ return visitor._(value.$unknown[0], value.$unknown[1]);
872
+ }, "visit");
873
+ })(OptimizedPrompt || (OptimizedPrompt = {}));
874
+ var OptimizedPromptStream;
875
+ ((OptimizedPromptStream3) => {
876
+ OptimizedPromptStream3.visit = /* @__PURE__ */ __name((value, visitor) => {
877
+ if (value.optimizedPromptEvent !== void 0)
878
+ return visitor.optimizedPromptEvent(value.optimizedPromptEvent);
879
+ if (value.analyzePromptEvent !== void 0)
880
+ return visitor.analyzePromptEvent(value.analyzePromptEvent);
881
+ if (value.internalServerException !== void 0)
882
+ return visitor.internalServerException(value.internalServerException);
883
+ if (value.throttlingException !== void 0)
884
+ return visitor.throttlingException(value.throttlingException);
885
+ if (value.validationException !== void 0)
886
+ return visitor.validationException(value.validationException);
887
+ if (value.dependencyFailedException !== void 0)
888
+ return visitor.dependencyFailedException(value.dependencyFailedException);
889
+ if (value.accessDeniedException !== void 0)
890
+ return visitor.accessDeniedException(value.accessDeniedException);
891
+ if (value.badGatewayException !== void 0)
892
+ return visitor.badGatewayException(value.badGatewayException);
893
+ return visitor._(value.$unknown[0], value.$unknown[1]);
894
+ }, "visit");
895
+ })(OptimizedPromptStream || (OptimizedPromptStream = {}));
846
896
  var ExternalSourceType = {
847
897
  BYTE_CONTENT: "BYTE_CONTENT",
848
898
  S3: "S3"
@@ -1300,6 +1350,56 @@ var InvokeAgentResponseFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({
1300
1350
  ...obj,
1301
1351
  ...obj.completion && { completion: "STREAMING_CONTENT" }
1302
1352
  }), "InvokeAgentResponseFilterSensitiveLog");
1353
+ var TextPromptFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({
1354
+ ...obj
1355
+ }), "TextPromptFilterSensitiveLog");
1356
+ var InputPromptFilterSensitiveLog = /* @__PURE__ */ __name((obj) => {
1357
+ if (obj.textPrompt !== void 0)
1358
+ return { textPrompt: import_smithy_client.SENSITIVE_STRING };
1359
+ if (obj.$unknown !== void 0)
1360
+ return { [obj.$unknown[0]]: "UNKNOWN" };
1361
+ }, "InputPromptFilterSensitiveLog");
1362
+ var OptimizePromptRequestFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({
1363
+ ...obj,
1364
+ ...obj.input && { input: InputPromptFilterSensitiveLog(obj.input) }
1365
+ }), "OptimizePromptRequestFilterSensitiveLog");
1366
+ var AnalyzePromptEventFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({
1367
+ ...obj
1368
+ }), "AnalyzePromptEventFilterSensitiveLog");
1369
+ var OptimizedPromptFilterSensitiveLog = /* @__PURE__ */ __name((obj) => {
1370
+ if (obj.textPrompt !== void 0)
1371
+ return { textPrompt: import_smithy_client.SENSITIVE_STRING };
1372
+ if (obj.$unknown !== void 0)
1373
+ return { [obj.$unknown[0]]: "UNKNOWN" };
1374
+ }, "OptimizedPromptFilterSensitiveLog");
1375
+ var OptimizedPromptEventFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({
1376
+ ...obj,
1377
+ ...obj.optimizedPrompt && { optimizedPrompt: OptimizedPromptFilterSensitiveLog(obj.optimizedPrompt) }
1378
+ }), "OptimizedPromptEventFilterSensitiveLog");
1379
+ var OptimizedPromptStreamFilterSensitiveLog = /* @__PURE__ */ __name((obj) => {
1380
+ if (obj.optimizedPromptEvent !== void 0)
1381
+ return { optimizedPromptEvent: import_smithy_client.SENSITIVE_STRING };
1382
+ if (obj.analyzePromptEvent !== void 0)
1383
+ return { analyzePromptEvent: import_smithy_client.SENSITIVE_STRING };
1384
+ if (obj.internalServerException !== void 0)
1385
+ return { internalServerException: obj.internalServerException };
1386
+ if (obj.throttlingException !== void 0)
1387
+ return { throttlingException: obj.throttlingException };
1388
+ if (obj.validationException !== void 0)
1389
+ return { validationException: obj.validationException };
1390
+ if (obj.dependencyFailedException !== void 0)
1391
+ return { dependencyFailedException: obj.dependencyFailedException };
1392
+ if (obj.accessDeniedException !== void 0)
1393
+ return { accessDeniedException: obj.accessDeniedException };
1394
+ if (obj.badGatewayException !== void 0)
1395
+ return { badGatewayException: obj.badGatewayException };
1396
+ if (obj.$unknown !== void 0)
1397
+ return { [obj.$unknown[0]]: "UNKNOWN" };
1398
+ }, "OptimizedPromptStreamFilterSensitiveLog");
1399
+ var OptimizePromptResponseFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({
1400
+ ...obj,
1401
+ ...obj.optimizedPrompt && { optimizedPrompt: "STREAMING_CONTENT" }
1402
+ }), "OptimizePromptResponseFilterSensitiveLog");
1303
1403
  var RetrieveAndGenerateInputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({
1304
1404
  ...obj
1305
1405
  }), "RetrieveAndGenerateInputFilterSensitiveLog");
@@ -1533,6 +1633,22 @@ var se_InvokeFlowCommand = /* @__PURE__ */ __name(async (input, context) => {
1533
1633
  b.m("POST").h(headers).b(body);
1534
1634
  return b.build();
1535
1635
  }, "se_InvokeFlowCommand");
1636
+ var se_OptimizePromptCommand = /* @__PURE__ */ __name(async (input, context) => {
1637
+ const b = (0, import_core.requestBuilder)(input, context);
1638
+ const headers = {
1639
+ "content-type": "application/json"
1640
+ };
1641
+ b.bp("/optimize-prompt");
1642
+ let body;
1643
+ body = JSON.stringify(
1644
+ (0, import_smithy_client.take)(input, {
1645
+ input: (_) => (0, import_smithy_client._json)(_),
1646
+ targetModelId: []
1647
+ })
1648
+ );
1649
+ b.m("POST").h(headers).b(body);
1650
+ return b.build();
1651
+ }, "se_OptimizePromptCommand");
1536
1652
  var se_RetrieveCommand = /* @__PURE__ */ __name(async (input, context) => {
1537
1653
  const b = (0, import_core.requestBuilder)(input, context);
1538
1654
  const headers = {
@@ -1619,6 +1735,17 @@ var de_InvokeFlowCommand = /* @__PURE__ */ __name(async (output, context) => {
1619
1735
  contents.responseStream = de_FlowResponseStream(data, context);
1620
1736
  return contents;
1621
1737
  }, "de_InvokeFlowCommand");
1738
+ var de_OptimizePromptCommand = /* @__PURE__ */ __name(async (output, context) => {
1739
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
1740
+ return de_CommandError(output, context);
1741
+ }
1742
+ const contents = (0, import_smithy_client.map)({
1743
+ $metadata: deserializeMetadata(output)
1744
+ });
1745
+ const data = output.body;
1746
+ contents.optimizedPrompt = de_OptimizedPromptStream(data, context);
1747
+ return contents;
1748
+ }, "de_OptimizePromptCommand");
1622
1749
  var de_RetrieveCommand = /* @__PURE__ */ __name(async (output, context) => {
1623
1750
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1624
1751
  return de_CommandError(output, context);
@@ -1888,6 +2015,54 @@ var de_FlowResponseStream = /* @__PURE__ */ __name((output, context) => {
1888
2015
  return { $unknown: output };
1889
2016
  });
1890
2017
  }, "de_FlowResponseStream");
2018
+ var de_OptimizedPromptStream = /* @__PURE__ */ __name((output, context) => {
2019
+ return context.eventStreamMarshaller.deserialize(output, async (event) => {
2020
+ if (event["optimizedPromptEvent"] != null) {
2021
+ return {
2022
+ optimizedPromptEvent: await de_OptimizedPromptEvent_event(event["optimizedPromptEvent"], context)
2023
+ };
2024
+ }
2025
+ if (event["analyzePromptEvent"] != null) {
2026
+ return {
2027
+ analyzePromptEvent: await de_AnalyzePromptEvent_event(event["analyzePromptEvent"], context)
2028
+ };
2029
+ }
2030
+ if (event["internalServerException"] != null) {
2031
+ return {
2032
+ internalServerException: await de_InternalServerException_event(event["internalServerException"], context)
2033
+ };
2034
+ }
2035
+ if (event["throttlingException"] != null) {
2036
+ return {
2037
+ throttlingException: await de_ThrottlingException_event(event["throttlingException"], context)
2038
+ };
2039
+ }
2040
+ if (event["validationException"] != null) {
2041
+ return {
2042
+ validationException: await de_ValidationException_event(event["validationException"], context)
2043
+ };
2044
+ }
2045
+ if (event["dependencyFailedException"] != null) {
2046
+ return {
2047
+ dependencyFailedException: await de_DependencyFailedException_event(
2048
+ event["dependencyFailedException"],
2049
+ context
2050
+ )
2051
+ };
2052
+ }
2053
+ if (event["accessDeniedException"] != null) {
2054
+ return {
2055
+ accessDeniedException: await de_AccessDeniedException_event(event["accessDeniedException"], context)
2056
+ };
2057
+ }
2058
+ if (event["badGatewayException"] != null) {
2059
+ return {
2060
+ badGatewayException: await de_BadGatewayException_event(event["badGatewayException"], context)
2061
+ };
2062
+ }
2063
+ return { $unknown: output };
2064
+ });
2065
+ }, "de_OptimizedPromptStream");
1891
2066
  var de_ResponseStream = /* @__PURE__ */ __name((output, context) => {
1892
2067
  return context.eventStreamMarshaller.deserialize(output, async (event) => {
1893
2068
  if (event["chunk"] != null) {
@@ -1974,6 +2149,12 @@ var de_AccessDeniedException_event = /* @__PURE__ */ __name(async (output, conte
1974
2149
  };
1975
2150
  return de_AccessDeniedExceptionRes(parsedOutput, context);
1976
2151
  }, "de_AccessDeniedException_event");
2152
+ var de_AnalyzePromptEvent_event = /* @__PURE__ */ __name(async (output, context) => {
2153
+ const contents = {};
2154
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
2155
+ Object.assign(contents, (0, import_smithy_client._json)(data));
2156
+ return contents;
2157
+ }, "de_AnalyzePromptEvent_event");
1977
2158
  var de_BadGatewayException_event = /* @__PURE__ */ __name(async (output, context) => {
1978
2159
  const parsedOutput = {
1979
2160
  ...output,
@@ -2026,6 +2207,12 @@ var de_InternalServerException_event = /* @__PURE__ */ __name(async (output, con
2026
2207
  };
2027
2208
  return de_InternalServerExceptionRes(parsedOutput, context);
2028
2209
  }, "de_InternalServerException_event");
2210
+ var de_OptimizedPromptEvent_event = /* @__PURE__ */ __name(async (output, context) => {
2211
+ const contents = {};
2212
+ const data = await (0, import_core2.parseJsonBody)(output.body, context);
2213
+ Object.assign(contents, (0, import_smithy_client._json)(data));
2214
+ return contents;
2215
+ }, "de_OptimizedPromptEvent_event");
2029
2216
  var de_PayloadPart_event = /* @__PURE__ */ __name(async (output, context) => {
2030
2217
  const contents = {};
2031
2218
  const data = await (0, import_core2.parseJsonBody)(output.body, context);
@@ -2689,6 +2876,27 @@ var _InvokeFlowCommand = class _InvokeFlowCommand extends import_smithy_client.C
2689
2876
  __name(_InvokeFlowCommand, "InvokeFlowCommand");
2690
2877
  var InvokeFlowCommand = _InvokeFlowCommand;
2691
2878
 
2879
+ // src/commands/OptimizePromptCommand.ts
2880
+
2881
+
2882
+
2883
+ var _OptimizePromptCommand = class _OptimizePromptCommand extends import_smithy_client.Command.classBuilder().ep(commonParams).m(function(Command, cs, config, o) {
2884
+ return [
2885
+ (0, import_middleware_serde.getSerdePlugin)(config, this.serialize, this.deserialize),
2886
+ (0, import_middleware_endpoint.getEndpointPlugin)(config, Command.getEndpointParameterInstructions())
2887
+ ];
2888
+ }).s("AmazonBedrockAgentRunTimeService", "OptimizePrompt", {
2889
+ /**
2890
+ * @internal
2891
+ */
2892
+ eventStream: {
2893
+ output: true
2894
+ }
2895
+ }).n("BedrockAgentRuntimeClient", "OptimizePromptCommand").f(OptimizePromptRequestFilterSensitiveLog, OptimizePromptResponseFilterSensitiveLog).ser(se_OptimizePromptCommand).de(de_OptimizePromptCommand).build() {
2896
+ };
2897
+ __name(_OptimizePromptCommand, "OptimizePromptCommand");
2898
+ var OptimizePromptCommand = _OptimizePromptCommand;
2899
+
2692
2900
  // src/commands/RetrieveAndGenerateCommand.ts
2693
2901
 
2694
2902
 
@@ -2723,6 +2931,7 @@ var commands = {
2723
2931
  GetAgentMemoryCommand,
2724
2932
  InvokeAgentCommand,
2725
2933
  InvokeFlowCommand,
2934
+ OptimizePromptCommand,
2726
2935
  RetrieveCommand,
2727
2936
  RetrieveAndGenerateCommand
2728
2937
  };
@@ -2751,6 +2960,7 @@ var paginateRetrieve = (0, import_core.createPaginator)(BedrockAgentRuntimeClien
2751
2960
  GetAgentMemoryCommand,
2752
2961
  InvokeAgentCommand,
2753
2962
  InvokeFlowCommand,
2963
+ OptimizePromptCommand,
2754
2964
  RetrieveAndGenerateCommand,
2755
2965
  RetrieveCommand,
2756
2966
  paginateGetAgentMemory,
@@ -2804,6 +3014,9 @@ var paginateRetrieve = (0, import_core.createPaginator)(BedrockAgentRuntimeClien
2804
3014
  ResponseStream,
2805
3015
  MemoryType,
2806
3016
  Memory,
3017
+ InputPrompt,
3018
+ OptimizedPrompt,
3019
+ OptimizedPromptStream,
2807
3020
  ExternalSourceType,
2808
3021
  QueryTransformationType,
2809
3022
  RetrieveAndGenerateType,
@@ -2881,6 +3094,14 @@ var paginateRetrieve = (0, import_core.createPaginator)(BedrockAgentRuntimeClien
2881
3094
  TracePartFilterSensitiveLog,
2882
3095
  ResponseStreamFilterSensitiveLog,
2883
3096
  InvokeAgentResponseFilterSensitiveLog,
3097
+ TextPromptFilterSensitiveLog,
3098
+ InputPromptFilterSensitiveLog,
3099
+ OptimizePromptRequestFilterSensitiveLog,
3100
+ AnalyzePromptEventFilterSensitiveLog,
3101
+ OptimizedPromptFilterSensitiveLog,
3102
+ OptimizedPromptEventFilterSensitiveLog,
3103
+ OptimizedPromptStreamFilterSensitiveLog,
3104
+ OptimizePromptResponseFilterSensitiveLog,
2884
3105
  RetrieveAndGenerateInputFilterSensitiveLog,
2885
3106
  PromptTemplateFilterSensitiveLog,
2886
3107
  ExternalSourcesGenerationConfigurationFilterSensitiveLog,
@@ -4,6 +4,7 @@ import { DeleteAgentMemoryCommand, } from "./commands/DeleteAgentMemoryCommand";
4
4
  import { GetAgentMemoryCommand, } from "./commands/GetAgentMemoryCommand";
5
5
  import { InvokeAgentCommand } from "./commands/InvokeAgentCommand";
6
6
  import { InvokeFlowCommand } from "./commands/InvokeFlowCommand";
7
+ import { OptimizePromptCommand, } from "./commands/OptimizePromptCommand";
7
8
  import { RetrieveAndGenerateCommand, } from "./commands/RetrieveAndGenerateCommand";
8
9
  import { RetrieveCommand } from "./commands/RetrieveCommand";
9
10
  const commands = {
@@ -11,6 +12,7 @@ const commands = {
11
12
  GetAgentMemoryCommand,
12
13
  InvokeAgentCommand,
13
14
  InvokeFlowCommand,
15
+ OptimizePromptCommand,
14
16
  RetrieveCommand,
15
17
  RetrieveAndGenerateCommand,
16
18
  };
@@ -0,0 +1,27 @@
1
+ import { getEndpointPlugin } from "@smithy/middleware-endpoint";
2
+ import { getSerdePlugin } from "@smithy/middleware-serde";
3
+ import { Command as $Command } from "@smithy/smithy-client";
4
+ import { commonParams } from "../endpoint/EndpointParameters";
5
+ import { OptimizePromptRequestFilterSensitiveLog, OptimizePromptResponseFilterSensitiveLog, } from "../models/models_0";
6
+ import { de_OptimizePromptCommand, se_OptimizePromptCommand } from "../protocols/Aws_restJson1";
7
+ export { $Command };
8
+ export class OptimizePromptCommand extends $Command
9
+ .classBuilder()
10
+ .ep(commonParams)
11
+ .m(function (Command, cs, config, o) {
12
+ return [
13
+ getSerdePlugin(config, this.serialize, this.deserialize),
14
+ getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
15
+ ];
16
+ })
17
+ .s("AmazonBedrockAgentRunTimeService", "OptimizePrompt", {
18
+ eventStream: {
19
+ output: true,
20
+ },
21
+ })
22
+ .n("BedrockAgentRuntimeClient", "OptimizePromptCommand")
23
+ .f(OptimizePromptRequestFilterSensitiveLog, OptimizePromptResponseFilterSensitiveLog)
24
+ .ser(se_OptimizePromptCommand)
25
+ .de(de_OptimizePromptCommand)
26
+ .build() {
27
+ }
@@ -2,5 +2,6 @@ export * from "./DeleteAgentMemoryCommand";
2
2
  export * from "./GetAgentMemoryCommand";
3
3
  export * from "./InvokeAgentCommand";
4
4
  export * from "./InvokeFlowCommand";
5
+ export * from "./OptimizePromptCommand";
5
6
  export * from "./RetrieveAndGenerateCommand";
6
7
  export * from "./RetrieveCommand";
@@ -445,6 +445,44 @@ export var Memory;
445
445
  return visitor._(value.$unknown[0], value.$unknown[1]);
446
446
  };
447
447
  })(Memory || (Memory = {}));
448
+ export var InputPrompt;
449
+ (function (InputPrompt) {
450
+ InputPrompt.visit = (value, visitor) => {
451
+ if (value.textPrompt !== undefined)
452
+ return visitor.textPrompt(value.textPrompt);
453
+ return visitor._(value.$unknown[0], value.$unknown[1]);
454
+ };
455
+ })(InputPrompt || (InputPrompt = {}));
456
+ export var OptimizedPrompt;
457
+ (function (OptimizedPrompt) {
458
+ OptimizedPrompt.visit = (value, visitor) => {
459
+ if (value.textPrompt !== undefined)
460
+ return visitor.textPrompt(value.textPrompt);
461
+ return visitor._(value.$unknown[0], value.$unknown[1]);
462
+ };
463
+ })(OptimizedPrompt || (OptimizedPrompt = {}));
464
+ export var OptimizedPromptStream;
465
+ (function (OptimizedPromptStream) {
466
+ OptimizedPromptStream.visit = (value, visitor) => {
467
+ if (value.optimizedPromptEvent !== undefined)
468
+ return visitor.optimizedPromptEvent(value.optimizedPromptEvent);
469
+ if (value.analyzePromptEvent !== undefined)
470
+ return visitor.analyzePromptEvent(value.analyzePromptEvent);
471
+ if (value.internalServerException !== undefined)
472
+ return visitor.internalServerException(value.internalServerException);
473
+ if (value.throttlingException !== undefined)
474
+ return visitor.throttlingException(value.throttlingException);
475
+ if (value.validationException !== undefined)
476
+ return visitor.validationException(value.validationException);
477
+ if (value.dependencyFailedException !== undefined)
478
+ return visitor.dependencyFailedException(value.dependencyFailedException);
479
+ if (value.accessDeniedException !== undefined)
480
+ return visitor.accessDeniedException(value.accessDeniedException);
481
+ if (value.badGatewayException !== undefined)
482
+ return visitor.badGatewayException(value.badGatewayException);
483
+ return visitor._(value.$unknown[0], value.$unknown[1]);
484
+ };
485
+ })(OptimizedPromptStream || (OptimizedPromptStream = {}));
448
486
  export const ExternalSourceType = {
449
487
  BYTE_CONTENT: "BYTE_CONTENT",
450
488
  S3: "S3",
@@ -902,6 +940,56 @@ export const InvokeAgentResponseFilterSensitiveLog = (obj) => ({
902
940
  ...obj,
903
941
  ...(obj.completion && { completion: "STREAMING_CONTENT" }),
904
942
  });
943
+ export const TextPromptFilterSensitiveLog = (obj) => ({
944
+ ...obj,
945
+ });
946
+ export const InputPromptFilterSensitiveLog = (obj) => {
947
+ if (obj.textPrompt !== undefined)
948
+ return { textPrompt: SENSITIVE_STRING };
949
+ if (obj.$unknown !== undefined)
950
+ return { [obj.$unknown[0]]: "UNKNOWN" };
951
+ };
952
+ export const OptimizePromptRequestFilterSensitiveLog = (obj) => ({
953
+ ...obj,
954
+ ...(obj.input && { input: InputPromptFilterSensitiveLog(obj.input) }),
955
+ });
956
+ export const AnalyzePromptEventFilterSensitiveLog = (obj) => ({
957
+ ...obj,
958
+ });
959
+ export const OptimizedPromptFilterSensitiveLog = (obj) => {
960
+ if (obj.textPrompt !== undefined)
961
+ return { textPrompt: SENSITIVE_STRING };
962
+ if (obj.$unknown !== undefined)
963
+ return { [obj.$unknown[0]]: "UNKNOWN" };
964
+ };
965
+ export const OptimizedPromptEventFilterSensitiveLog = (obj) => ({
966
+ ...obj,
967
+ ...(obj.optimizedPrompt && { optimizedPrompt: OptimizedPromptFilterSensitiveLog(obj.optimizedPrompt) }),
968
+ });
969
+ export const OptimizedPromptStreamFilterSensitiveLog = (obj) => {
970
+ if (obj.optimizedPromptEvent !== undefined)
971
+ return { optimizedPromptEvent: SENSITIVE_STRING };
972
+ if (obj.analyzePromptEvent !== undefined)
973
+ return { analyzePromptEvent: SENSITIVE_STRING };
974
+ if (obj.internalServerException !== undefined)
975
+ return { internalServerException: obj.internalServerException };
976
+ if (obj.throttlingException !== undefined)
977
+ return { throttlingException: obj.throttlingException };
978
+ if (obj.validationException !== undefined)
979
+ return { validationException: obj.validationException };
980
+ if (obj.dependencyFailedException !== undefined)
981
+ return { dependencyFailedException: obj.dependencyFailedException };
982
+ if (obj.accessDeniedException !== undefined)
983
+ return { accessDeniedException: obj.accessDeniedException };
984
+ if (obj.badGatewayException !== undefined)
985
+ return { badGatewayException: obj.badGatewayException };
986
+ if (obj.$unknown !== undefined)
987
+ return { [obj.$unknown[0]]: "UNKNOWN" };
988
+ };
989
+ export const OptimizePromptResponseFilterSensitiveLog = (obj) => ({
990
+ ...obj,
991
+ ...(obj.optimizedPrompt && { optimizedPrompt: "STREAMING_CONTENT" }),
992
+ });
905
993
  export const RetrieveAndGenerateInputFilterSensitiveLog = (obj) => ({
906
994
  ...obj,
907
995
  });
@@ -68,6 +68,20 @@ export const se_InvokeFlowCommand = async (input, context) => {
68
68
  b.m("POST").h(headers).b(body);
69
69
  return b.build();
70
70
  };
71
+ export const se_OptimizePromptCommand = async (input, context) => {
72
+ const b = rb(input, context);
73
+ const headers = {
74
+ "content-type": "application/json",
75
+ };
76
+ b.bp("/optimize-prompt");
77
+ let body;
78
+ body = JSON.stringify(take(input, {
79
+ input: (_) => _json(_),
80
+ targetModelId: [],
81
+ }));
82
+ b.m("POST").h(headers).b(body);
83
+ return b.build();
84
+ };
71
85
  export const se_RetrieveCommand = async (input, context) => {
72
86
  const b = rb(input, context);
73
87
  const headers = {
@@ -150,6 +164,17 @@ export const de_InvokeFlowCommand = async (output, context) => {
150
164
  contents.responseStream = de_FlowResponseStream(data, context);
151
165
  return contents;
152
166
  };
167
+ export const de_OptimizePromptCommand = async (output, context) => {
168
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
169
+ return de_CommandError(output, context);
170
+ }
171
+ const contents = map({
172
+ $metadata: deserializeMetadata(output),
173
+ });
174
+ const data = output.body;
175
+ contents.optimizedPrompt = de_OptimizedPromptStream(data, context);
176
+ return contents;
177
+ };
153
178
  export const de_RetrieveCommand = async (output, context) => {
154
179
  if (output.statusCode !== 200 && output.statusCode >= 300) {
155
180
  return de_CommandError(output, context);
@@ -410,6 +435,51 @@ const de_FlowResponseStream = (output, context) => {
410
435
  return { $unknown: output };
411
436
  });
412
437
  };
438
+ const de_OptimizedPromptStream = (output, context) => {
439
+ return context.eventStreamMarshaller.deserialize(output, async (event) => {
440
+ if (event["optimizedPromptEvent"] != null) {
441
+ return {
442
+ optimizedPromptEvent: await de_OptimizedPromptEvent_event(event["optimizedPromptEvent"], context),
443
+ };
444
+ }
445
+ if (event["analyzePromptEvent"] != null) {
446
+ return {
447
+ analyzePromptEvent: await de_AnalyzePromptEvent_event(event["analyzePromptEvent"], context),
448
+ };
449
+ }
450
+ if (event["internalServerException"] != null) {
451
+ return {
452
+ internalServerException: await de_InternalServerException_event(event["internalServerException"], context),
453
+ };
454
+ }
455
+ if (event["throttlingException"] != null) {
456
+ return {
457
+ throttlingException: await de_ThrottlingException_event(event["throttlingException"], context),
458
+ };
459
+ }
460
+ if (event["validationException"] != null) {
461
+ return {
462
+ validationException: await de_ValidationException_event(event["validationException"], context),
463
+ };
464
+ }
465
+ if (event["dependencyFailedException"] != null) {
466
+ return {
467
+ dependencyFailedException: await de_DependencyFailedException_event(event["dependencyFailedException"], context),
468
+ };
469
+ }
470
+ if (event["accessDeniedException"] != null) {
471
+ return {
472
+ accessDeniedException: await de_AccessDeniedException_event(event["accessDeniedException"], context),
473
+ };
474
+ }
475
+ if (event["badGatewayException"] != null) {
476
+ return {
477
+ badGatewayException: await de_BadGatewayException_event(event["badGatewayException"], context),
478
+ };
479
+ }
480
+ return { $unknown: output };
481
+ });
482
+ };
413
483
  const de_ResponseStream = (output, context) => {
414
484
  return context.eventStreamMarshaller.deserialize(output, async (event) => {
415
485
  if (event["chunk"] != null) {
@@ -487,6 +557,12 @@ const de_AccessDeniedException_event = async (output, context) => {
487
557
  };
488
558
  return de_AccessDeniedExceptionRes(parsedOutput, context);
489
559
  };
560
+ const de_AnalyzePromptEvent_event = async (output, context) => {
561
+ const contents = {};
562
+ const data = await parseBody(output.body, context);
563
+ Object.assign(contents, _json(data));
564
+ return contents;
565
+ };
490
566
  const de_BadGatewayException_event = async (output, context) => {
491
567
  const parsedOutput = {
492
568
  ...output,
@@ -539,6 +615,12 @@ const de_InternalServerException_event = async (output, context) => {
539
615
  };
540
616
  return de_InternalServerExceptionRes(parsedOutput, context);
541
617
  };
618
+ const de_OptimizedPromptEvent_event = async (output, context) => {
619
+ const contents = {};
620
+ const data = await parseBody(output.body, context);
621
+ Object.assign(contents, _json(data));
622
+ return contents;
623
+ };
542
624
  const de_PayloadPart_event = async (output, context) => {
543
625
  const contents = {};
544
626
  const data = await parseBody(output.body, context);
@@ -4,6 +4,7 @@ import { DeleteAgentMemoryCommandInput, DeleteAgentMemoryCommandOutput } from ".
4
4
  import { GetAgentMemoryCommandInput, GetAgentMemoryCommandOutput } from "./commands/GetAgentMemoryCommand";
5
5
  import { InvokeAgentCommandInput, InvokeAgentCommandOutput } from "./commands/InvokeAgentCommand";
6
6
  import { InvokeFlowCommandInput, InvokeFlowCommandOutput } from "./commands/InvokeFlowCommand";
7
+ import { OptimizePromptCommandInput, OptimizePromptCommandOutput } from "./commands/OptimizePromptCommand";
7
8
  import { RetrieveAndGenerateCommandInput, RetrieveAndGenerateCommandOutput } from "./commands/RetrieveAndGenerateCommand";
8
9
  import { RetrieveCommandInput, RetrieveCommandOutput } from "./commands/RetrieveCommand";
9
10
  export interface BedrockAgentRuntime {
@@ -31,6 +32,12 @@ export interface BedrockAgentRuntime {
31
32
  invokeFlow(args: InvokeFlowCommandInput, options?: __HttpHandlerOptions): Promise<InvokeFlowCommandOutput>;
32
33
  invokeFlow(args: InvokeFlowCommandInput, cb: (err: any, data?: InvokeFlowCommandOutput) => void): void;
33
34
  invokeFlow(args: InvokeFlowCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: InvokeFlowCommandOutput) => void): void;
35
+ /**
36
+ * @see {@link OptimizePromptCommand}
37
+ */
38
+ optimizePrompt(args: OptimizePromptCommandInput, options?: __HttpHandlerOptions): Promise<OptimizePromptCommandOutput>;
39
+ optimizePrompt(args: OptimizePromptCommandInput, cb: (err: any, data?: OptimizePromptCommandOutput) => void): void;
40
+ optimizePrompt(args: OptimizePromptCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: OptimizePromptCommandOutput) => void): void;
34
41
  /**
35
42
  * @see {@link RetrieveCommand}
36
43
  */
@@ -12,6 +12,7 @@ import { DeleteAgentMemoryCommandInput, DeleteAgentMemoryCommandOutput } from ".
12
12
  import { GetAgentMemoryCommandInput, GetAgentMemoryCommandOutput } from "./commands/GetAgentMemoryCommand";
13
13
  import { InvokeAgentCommandInput, InvokeAgentCommandOutput } from "./commands/InvokeAgentCommand";
14
14
  import { InvokeFlowCommandInput, InvokeFlowCommandOutput } from "./commands/InvokeFlowCommand";
15
+ import { OptimizePromptCommandInput, OptimizePromptCommandOutput } from "./commands/OptimizePromptCommand";
15
16
  import { RetrieveAndGenerateCommandInput, RetrieveAndGenerateCommandOutput } from "./commands/RetrieveAndGenerateCommand";
16
17
  import { RetrieveCommandInput, RetrieveCommandOutput } from "./commands/RetrieveCommand";
17
18
  import { ClientInputEndpointParameters, ClientResolvedEndpointParameters, EndpointParameters } from "./endpoint/EndpointParameters";
@@ -20,11 +21,11 @@ export { __Client };
20
21
  /**
21
22
  * @public
22
23
  */
23
- export type ServiceInputTypes = DeleteAgentMemoryCommandInput | GetAgentMemoryCommandInput | InvokeAgentCommandInput | InvokeFlowCommandInput | RetrieveAndGenerateCommandInput | RetrieveCommandInput;
24
+ export type ServiceInputTypes = DeleteAgentMemoryCommandInput | GetAgentMemoryCommandInput | InvokeAgentCommandInput | InvokeFlowCommandInput | OptimizePromptCommandInput | RetrieveAndGenerateCommandInput | RetrieveCommandInput;
24
25
  /**
25
26
  * @public
26
27
  */
27
- export type ServiceOutputTypes = DeleteAgentMemoryCommandOutput | GetAgentMemoryCommandOutput | InvokeAgentCommandOutput | InvokeFlowCommandOutput | RetrieveAndGenerateCommandOutput | RetrieveCommandOutput;
28
+ export type ServiceOutputTypes = DeleteAgentMemoryCommandOutput | GetAgentMemoryCommandOutput | InvokeAgentCommandOutput | InvokeFlowCommandOutput | OptimizePromptCommandOutput | RetrieveAndGenerateCommandOutput | RetrieveCommandOutput;
28
29
  /**
29
30
  * @public
30
31
  */
@@ -27,7 +27,7 @@ declare const InvokeFlowCommand_base: {
27
27
  getEndpointParameterInstructions(): import("@smithy/middleware-endpoint").EndpointParameterInstructions;
28
28
  };
29
29
  /**
30
- * <p>Invokes an alias of a flow to run the inputs that you specify and return the output of each node as a stream. If there's an error, the error is returned. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/flows-test.html">Test a flow in Amazon Bedrock</a> in the Amazon Bedrock User Guide.</p>
30
+ * <p>Invokes an alias of a flow to run the inputs that you specify and return the output of each node as a stream. If there's an error, the error is returned. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/flows-test.html">Test a flow in Amazon Bedrock</a> in the <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-service.html">Amazon Bedrock User Guide</a>.</p>
31
31
  * <note>
32
32
  * <p>The CLI doesn't support streaming operations in Amazon Bedrock, including <code>InvokeFlow</code>.</p>
33
33
  * </note>