@aws-sdk/client-bedrock-runtime 3.686.0 → 3.691.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist-cjs/index.js CHANGED
@@ -32,9 +32,11 @@ __export(src_exports, {
32
32
  ConversationRole: () => ConversationRole,
33
33
  ConverseCommand: () => ConverseCommand,
34
34
  ConverseOutput: () => ConverseOutput,
35
+ ConverseRequestFilterSensitiveLog: () => ConverseRequestFilterSensitiveLog,
35
36
  ConverseStreamCommand: () => ConverseStreamCommand,
36
37
  ConverseStreamOutput: () => ConverseStreamOutput,
37
38
  ConverseStreamOutputFilterSensitiveLog: () => ConverseStreamOutputFilterSensitiveLog,
39
+ ConverseStreamRequestFilterSensitiveLog: () => ConverseStreamRequestFilterSensitiveLog,
38
40
  ConverseStreamResponseFilterSensitiveLog: () => ConverseStreamResponseFilterSensitiveLog,
39
41
  DocumentFormat: () => DocumentFormat,
40
42
  DocumentSource: () => DocumentSource,
@@ -72,6 +74,7 @@ __export(src_exports, {
72
74
  ModelStreamErrorException: () => ModelStreamErrorException,
73
75
  ModelTimeoutException: () => ModelTimeoutException,
74
76
  PayloadPartFilterSensitiveLog: () => PayloadPartFilterSensitiveLog,
77
+ PromptVariableValues: () => PromptVariableValues,
75
78
  ResourceNotFoundException: () => ResourceNotFoundException,
76
79
  ResponseStream: () => ResponseStream,
77
80
  ResponseStreamFilterSensitiveLog: () => ResponseStreamFilterSensitiveLog,
@@ -552,6 +555,14 @@ var ConversationRole = {
552
555
  ASSISTANT: "assistant",
553
556
  USER: "user"
554
557
  };
558
+ var PromptVariableValues;
559
+ ((PromptVariableValues3) => {
560
+ PromptVariableValues3.visit = /* @__PURE__ */ __name((value, visitor) => {
561
+ if (value.text !== void 0)
562
+ return visitor.text(value.text);
563
+ return visitor._(value.$unknown[0], value.$unknown[1]);
564
+ }, "visit");
565
+ })(PromptVariableValues || (PromptVariableValues = {}));
555
566
  var SystemContentBlock;
556
567
  ((SystemContentBlock3) => {
557
568
  SystemContentBlock3.visit = /* @__PURE__ */ __name((value, visitor) => {
@@ -770,6 +781,20 @@ var ResponseStream;
770
781
  return visitor._(value.$unknown[0], value.$unknown[1]);
771
782
  }, "visit");
772
783
  })(ResponseStream || (ResponseStream = {}));
784
+ var ConverseRequestFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({
785
+ ...obj,
786
+ ...obj.messages && { messages: obj.messages.map((item) => item) },
787
+ ...obj.system && { system: obj.system.map((item) => item) },
788
+ ...obj.toolConfig && { toolConfig: obj.toolConfig },
789
+ ...obj.promptVariables && { promptVariables: import_smithy_client.SENSITIVE_STRING }
790
+ }), "ConverseRequestFilterSensitiveLog");
791
+ var ConverseStreamRequestFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({
792
+ ...obj,
793
+ ...obj.messages && { messages: obj.messages.map((item) => item) },
794
+ ...obj.system && { system: obj.system.map((item) => item) },
795
+ ...obj.toolConfig && { toolConfig: obj.toolConfig },
796
+ ...obj.promptVariables && { promptVariables: import_smithy_client.SENSITIVE_STRING }
797
+ }), "ConverseStreamRequestFilterSensitiveLog");
773
798
  var ConverseStreamOutputFilterSensitiveLog = /* @__PURE__ */ __name((obj) => {
774
799
  if (obj.messageStart !== void 0)
775
800
  return { messageStart: obj.messageStart };
@@ -873,6 +898,7 @@ var se_ConverseCommand = /* @__PURE__ */ __name(async (input, context) => {
873
898
  guardrailConfig: (_) => (0, import_smithy_client._json)(_),
874
899
  inferenceConfig: (_) => se_InferenceConfiguration(_, context),
875
900
  messages: (_) => se_Messages(_, context),
901
+ promptVariables: (_) => (0, import_smithy_client._json)(_),
876
902
  system: (_) => (0, import_smithy_client._json)(_),
877
903
  toolConfig: (_) => se_ToolConfiguration(_, context)
878
904
  })
@@ -895,6 +921,7 @@ var se_ConverseStreamCommand = /* @__PURE__ */ __name(async (input, context) =>
895
921
  guardrailConfig: (_) => (0, import_smithy_client._json)(_),
896
922
  inferenceConfig: (_) => se_InferenceConfiguration(_, context),
897
923
  messages: (_) => se_Messages(_, context),
924
+ promptVariables: (_) => (0, import_smithy_client._json)(_),
898
925
  system: (_) => (0, import_smithy_client._json)(_),
899
926
  toolConfig: (_) => se_ToolConfiguration(_, context)
900
927
  })
@@ -1774,7 +1801,7 @@ var _ConverseCommand = class _ConverseCommand extends import_smithy_client.Comma
1774
1801
  (0, import_middleware_serde.getSerdePlugin)(config, this.serialize, this.deserialize),
1775
1802
  (0, import_middleware_endpoint.getEndpointPlugin)(config, Command.getEndpointParameterInstructions())
1776
1803
  ];
1777
- }).s("AmazonBedrockFrontendService", "Converse", {}).n("BedrockRuntimeClient", "ConverseCommand").f(void 0, void 0).ser(se_ConverseCommand).de(de_ConverseCommand).build() {
1804
+ }).s("AmazonBedrockFrontendService", "Converse", {}).n("BedrockRuntimeClient", "ConverseCommand").f(ConverseRequestFilterSensitiveLog, void 0).ser(se_ConverseCommand).de(de_ConverseCommand).build() {
1778
1805
  };
1779
1806
  __name(_ConverseCommand, "ConverseCommand");
1780
1807
  var ConverseCommand = _ConverseCommand;
@@ -1795,7 +1822,7 @@ var _ConverseStreamCommand = class _ConverseStreamCommand extends import_smithy_
1795
1822
  eventStream: {
1796
1823
  output: true
1797
1824
  }
1798
- }).n("BedrockRuntimeClient", "ConverseStreamCommand").f(void 0, ConverseStreamResponseFilterSensitiveLog).ser(se_ConverseStreamCommand).de(de_ConverseStreamCommand).build() {
1825
+ }).n("BedrockRuntimeClient", "ConverseStreamCommand").f(ConverseStreamRequestFilterSensitiveLog, ConverseStreamResponseFilterSensitiveLog).ser(se_ConverseStreamCommand).de(de_ConverseStreamCommand).build() {
1799
1826
  };
1800
1827
  __name(_ConverseStreamCommand, "ConverseStreamCommand");
1801
1828
  var ConverseStreamCommand = _ConverseStreamCommand;
@@ -1894,6 +1921,7 @@ var BedrockRuntime = _BedrockRuntime;
1894
1921
  ToolResultStatus,
1895
1922
  ContentBlock,
1896
1923
  ConversationRole,
1924
+ PromptVariableValues,
1897
1925
  SystemContentBlock,
1898
1926
  ToolChoice,
1899
1927
  ToolInputSchema,
@@ -1911,6 +1939,8 @@ var BedrockRuntime = _BedrockRuntime;
1911
1939
  ConverseStreamOutput,
1912
1940
  Trace,
1913
1941
  ResponseStream,
1942
+ ConverseRequestFilterSensitiveLog,
1943
+ ConverseStreamRequestFilterSensitiveLog,
1914
1944
  ConverseStreamOutputFilterSensitiveLog,
1915
1945
  ConverseStreamResponseFilterSensitiveLog,
1916
1946
  InvokeModelRequestFilterSensitiveLog,
@@ -2,6 +2,7 @@ import { getEndpointPlugin } from "@smithy/middleware-endpoint";
2
2
  import { getSerdePlugin } from "@smithy/middleware-serde";
3
3
  import { Command as $Command } from "@smithy/smithy-client";
4
4
  import { commonParams } from "../endpoint/EndpointParameters";
5
+ import { ConverseRequestFilterSensitiveLog } from "../models/models_0";
5
6
  import { de_ConverseCommand, se_ConverseCommand } from "../protocols/Aws_restJson1";
6
7
  export { $Command };
7
8
  export class ConverseCommand extends $Command
@@ -15,7 +16,7 @@ export class ConverseCommand extends $Command
15
16
  })
16
17
  .s("AmazonBedrockFrontendService", "Converse", {})
17
18
  .n("BedrockRuntimeClient", "ConverseCommand")
18
- .f(void 0, void 0)
19
+ .f(ConverseRequestFilterSensitiveLog, void 0)
19
20
  .ser(se_ConverseCommand)
20
21
  .de(de_ConverseCommand)
21
22
  .build() {
@@ -2,7 +2,7 @@ import { getEndpointPlugin } from "@smithy/middleware-endpoint";
2
2
  import { getSerdePlugin } from "@smithy/middleware-serde";
3
3
  import { Command as $Command } from "@smithy/smithy-client";
4
4
  import { commonParams } from "../endpoint/EndpointParameters";
5
- import { ConverseStreamResponseFilterSensitiveLog, } from "../models/models_0";
5
+ import { ConverseStreamRequestFilterSensitiveLog, ConverseStreamResponseFilterSensitiveLog, } from "../models/models_0";
6
6
  import { de_ConverseStreamCommand, se_ConverseStreamCommand } from "../protocols/Aws_restJson1";
7
7
  export { $Command };
8
8
  export class ConverseStreamCommand extends $Command
@@ -20,7 +20,7 @@ export class ConverseStreamCommand extends $Command
20
20
  },
21
21
  })
22
22
  .n("BedrockRuntimeClient", "ConverseStreamCommand")
23
- .f(void 0, ConverseStreamResponseFilterSensitiveLog)
23
+ .f(ConverseStreamRequestFilterSensitiveLog, ConverseStreamResponseFilterSensitiveLog)
24
24
  .ser(se_ConverseStreamCommand)
25
25
  .de(de_ConverseStreamCommand)
26
26
  .build() {
@@ -263,6 +263,14 @@ export const ConversationRole = {
263
263
  ASSISTANT: "assistant",
264
264
  USER: "user",
265
265
  };
266
+ export var PromptVariableValues;
267
+ (function (PromptVariableValues) {
268
+ PromptVariableValues.visit = (value, visitor) => {
269
+ if (value.text !== undefined)
270
+ return visitor.text(value.text);
271
+ return visitor._(value.$unknown[0], value.$unknown[1]);
272
+ };
273
+ })(PromptVariableValues || (PromptVariableValues = {}));
266
274
  export var SystemContentBlock;
267
275
  (function (SystemContentBlock) {
268
276
  SystemContentBlock.visit = (value, visitor) => {
@@ -456,6 +464,20 @@ export var ResponseStream;
456
464
  return visitor._(value.$unknown[0], value.$unknown[1]);
457
465
  };
458
466
  })(ResponseStream || (ResponseStream = {}));
467
+ export const ConverseRequestFilterSensitiveLog = (obj) => ({
468
+ ...obj,
469
+ ...(obj.messages && { messages: obj.messages.map((item) => item) }),
470
+ ...(obj.system && { system: obj.system.map((item) => item) }),
471
+ ...(obj.toolConfig && { toolConfig: obj.toolConfig }),
472
+ ...(obj.promptVariables && { promptVariables: SENSITIVE_STRING }),
473
+ });
474
+ export const ConverseStreamRequestFilterSensitiveLog = (obj) => ({
475
+ ...obj,
476
+ ...(obj.messages && { messages: obj.messages.map((item) => item) }),
477
+ ...(obj.system && { system: obj.system.map((item) => item) }),
478
+ ...(obj.toolConfig && { toolConfig: obj.toolConfig }),
479
+ ...(obj.promptVariables && { promptVariables: SENSITIVE_STRING }),
480
+ });
459
481
  export const ConverseStreamOutputFilterSensitiveLog = (obj) => {
460
482
  if (obj.messageStart !== undefined)
461
483
  return { messageStart: obj.messageStart };
@@ -33,6 +33,7 @@ export const se_ConverseCommand = async (input, context) => {
33
33
  guardrailConfig: (_) => _json(_),
34
34
  inferenceConfig: (_) => se_InferenceConfiguration(_, context),
35
35
  messages: (_) => se_Messages(_, context),
36
+ promptVariables: (_) => _json(_),
36
37
  system: (_) => _json(_),
37
38
  toolConfig: (_) => se_ToolConfiguration(_, context),
38
39
  }));
@@ -53,6 +54,7 @@ export const se_ConverseStreamCommand = async (input, context) => {
53
54
  guardrailConfig: (_) => _json(_),
54
55
  inferenceConfig: (_) => se_InferenceConfiguration(_, context),
55
56
  messages: (_) => se_Messages(_, context),
57
+ promptVariables: (_) => _json(_),
56
58
  system: (_) => _json(_),
57
59
  toolConfig: (_) => se_ToolConfiguration(_, context),
58
60
  }));
@@ -33,6 +33,8 @@ declare const ConverseCommand_base: {
33
33
  * If a model has unique inference parameters, you can also pass those unique parameters
34
34
  * to the model.</p>
35
35
  * <p>Amazon Bedrock doesn't store any text, images, or documents that you provide as content. The data is only used to generate the response.</p>
36
+ * <p>You can submit a prompt by including it in the <code>messages</code> field, specifying the <code>modelId</code> of a foundation model or inference profile to run inference on it, and including any other fields that are relevant to your use case.</p>
37
+ * <p>You can also submit a prompt from Prompt management by specifying the ARN of the prompt version and including a map of variables to values in the <code>promptVariables</code> field. You can append more messages to the prompt by using the <code>messages</code> field. If you use a prompt from Prompt management, you can't include the following fields in the request: <code>additionalModelRequestFields</code>, <code>inferenceConfig</code>, <code>system</code>, or <code>toolConfig</code>. Instead, these fields must be defined through Prompt management. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-management-use.html">Use a prompt from Prompt management</a>.</p>
36
38
  * <p>For information about the Converse API, see <i>Use the Converse API</i> in the <i>Amazon Bedrock User Guide</i>.
37
39
  * To use a guardrail, see <i>Use a guardrail with the Converse API</i> in the <i>Amazon Bedrock User Guide</i>.
38
40
  * To use a tool with a model, see <i>Tool use (Function calling)</i> in the <i>Amazon Bedrock User Guide</i>
@@ -48,7 +50,7 @@ declare const ConverseCommand_base: {
48
50
  * const client = new BedrockRuntimeClient(config);
49
51
  * const input = { // ConverseRequest
50
52
  * modelId: "STRING_VALUE", // required
51
- * messages: [ // Messages // required
53
+ * messages: [ // Messages
52
54
  * { // Message
53
55
  * role: "user" || "assistant", // required
54
56
  * content: [ // ContentBlocks // required
@@ -154,6 +156,11 @@ declare const ConverseCommand_base: {
154
156
  * trace: "enabled" || "disabled",
155
157
  * },
156
158
  * additionalModelRequestFields: "DOCUMENT_VALUE",
159
+ * promptVariables: { // PromptVariableMap
160
+ * "<keys>": { // PromptVariableValues Union: only one key present
161
+ * text: "STRING_VALUE",
162
+ * },
163
+ * },
157
164
  * additionalModelResponseFieldPaths: [ // AdditionalModelResponseFieldPaths
158
165
  * "STRING_VALUE",
159
166
  * ],
@@ -39,6 +39,8 @@ declare const ConverseStreamCommand_base: {
39
39
  * <p>The CLI doesn't support streaming operations in Amazon Bedrock, including <code>ConverseStream</code>.</p>
40
40
  * </note>
41
41
  * <p>Amazon Bedrock doesn't store any text, images, or documents that you provide as content. The data is only used to generate the response.</p>
42
+ * <p>You can submit a prompt by including it in the <code>messages</code> field, specifying the <code>modelId</code> of a foundation model or inference profile to run inference on it, and including any other fields that are relevant to your use case.</p>
43
+ * <p>You can also submit a prompt from Prompt management by specifying the ARN of the prompt version and including a map of variables to values in the <code>promptVariables</code> field. You can append more messages to the prompt by using the <code>messages</code> field. If you use a prompt from Prompt management, you can't include the following fields in the request: <code>additionalModelRequestFields</code>, <code>inferenceConfig</code>, <code>system</code>, or <code>toolConfig</code>. Instead, these fields must be defined through Prompt management. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-management-use.html">Use a prompt from Prompt management</a>.</p>
42
44
  * <p>For information about the Converse API, see <i>Use the Converse API</i> in the <i>Amazon Bedrock User Guide</i>.
43
45
  * To use a guardrail, see <i>Use a guardrail with the Converse API</i> in the <i>Amazon Bedrock User Guide</i>.
44
46
  * To use a tool with a model, see <i>Tool use (Function calling)</i> in the <i>Amazon Bedrock User Guide</i>
@@ -54,7 +56,7 @@ declare const ConverseStreamCommand_base: {
54
56
  * const client = new BedrockRuntimeClient(config);
55
57
  * const input = { // ConverseStreamRequest
56
58
  * modelId: "STRING_VALUE", // required
57
- * messages: [ // Messages // required
59
+ * messages: [ // Messages
58
60
  * { // Message
59
61
  * role: "user" || "assistant", // required
60
62
  * content: [ // ContentBlocks // required
@@ -161,6 +163,11 @@ declare const ConverseStreamCommand_base: {
161
163
  * streamProcessingMode: "sync" || "async",
162
164
  * },
163
165
  * additionalModelRequestFields: "DOCUMENT_VALUE",
166
+ * promptVariables: { // PromptVariableMap
167
+ * "<keys>": { // PromptVariableValues Union: only one key present
168
+ * text: "STRING_VALUE",
169
+ * },
170
+ * },
164
171
  * additionalModelResponseFieldPaths: [ // AdditionalModelResponseFieldPaths
165
172
  * "STRING_VALUE",
166
173
  * ],
@@ -12,7 +12,7 @@ export { $Command };
12
12
  * @public
13
13
  */
14
14
  export type InvokeModelCommandInputType = Omit<InvokeModelRequest, "body"> & {
15
- body: BlobPayloadInputTypes;
15
+ body?: BlobPayloadInputTypes;
16
16
  };
17
17
  /**
18
18
  * @public
@@ -52,7 +52,7 @@ declare const InvokeModelCommand_base: {
52
52
  * // const { BedrockRuntimeClient, InvokeModelCommand } = require("@aws-sdk/client-bedrock-runtime"); // CommonJS import
53
53
  * const client = new BedrockRuntimeClient(config);
54
54
  * const input = { // InvokeModelRequest
55
- * body: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("") // required
55
+ * body: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
56
56
  * contentType: "STRING_VALUE",
57
57
  * accept: "STRING_VALUE",
58
58
  * modelId: "STRING_VALUE", // required
@@ -11,7 +11,7 @@ export { $Command };
11
11
  * @public
12
12
  */
13
13
  export type InvokeModelWithResponseStreamCommandInputType = Omit<InvokeModelWithResponseStreamRequest, "body"> & {
14
- body: BlobPayloadInputTypes;
14
+ body?: BlobPayloadInputTypes;
15
15
  };
16
16
  /**
17
17
  * @public
@@ -50,7 +50,7 @@ declare const InvokeModelWithResponseStreamCommand_base: {
50
50
  * // const { BedrockRuntimeClient, InvokeModelWithResponseStreamCommand } = require("@aws-sdk/client-bedrock-runtime"); // CommonJS import
51
51
  * const client = new BedrockRuntimeClient(config);
52
52
  * const input = { // InvokeModelWithResponseStreamRequest
53
- * body: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("") // required
53
+ * body: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
54
54
  * contentType: "STRING_VALUE",
55
55
  * accept: "STRING_VALUE",
56
56
  * modelId: "STRING_VALUE", // required