@aws-sdk/client-bedrock-agent-runtime 3.572.0 → 3.574.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
@@ -44,6 +44,7 @@ __export(src_exports, {
44
44
  FinalResponseFilterSensitiveLog: () => FinalResponseFilterSensitiveLog,
45
45
  GeneratedResponsePartFilterSensitiveLog: () => GeneratedResponsePartFilterSensitiveLog,
46
46
  GenerationConfigurationFilterSensitiveLog: () => GenerationConfigurationFilterSensitiveLog,
47
+ GuadrailAction: () => GuadrailAction,
47
48
  InternalServerException: () => InternalServerException,
48
49
  InvocationInputFilterSensitiveLog: () => InvocationInputFilterSensitiveLog,
49
50
  InvocationInputMember: () => InvocationInputMember,
@@ -586,6 +587,10 @@ var RetrieveAndGenerateType = {
586
587
  EXTERNAL_SOURCES: "EXTERNAL_SOURCES",
587
588
  KNOWLEDGE_BASE: "KNOWLEDGE_BASE"
588
589
  };
590
+ var GuadrailAction = {
591
+ INTERVENED: "INTERVENED",
592
+ NONE: "NONE"
593
+ };
589
594
  var RetrievalFilter;
590
595
  ((RetrievalFilter2) => {
591
596
  RetrievalFilter2.visit = /* @__PURE__ */ __name((value, visitor) => {
@@ -1074,6 +1079,7 @@ var de_RetrieveAndGenerateCommand = /* @__PURE__ */ __name(async (output, contex
1074
1079
  const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await (0, import_core2.parseJsonBody)(output.body, context)), "body");
1075
1080
  const doc = (0, import_smithy_client.take)(data, {
1076
1081
  citations: (_) => de_Citations(_, context),
1082
+ guardrailAction: import_smithy_client.expectString,
1077
1083
  output: import_smithy_client._json,
1078
1084
  sessionId: import_smithy_client.expectString
1079
1085
  });
@@ -1398,6 +1404,18 @@ var de_ValidationException_event = /* @__PURE__ */ __name(async (output, context
1398
1404
  };
1399
1405
  return de_ValidationExceptionRes(parsedOutput, context);
1400
1406
  }, "de_ValidationException_event");
1407
+ var se_AdditionalModelRequestFields = /* @__PURE__ */ __name((input, context) => {
1408
+ return Object.entries(input).reduce((acc, [key, value]) => {
1409
+ if (value === null) {
1410
+ return acc;
1411
+ }
1412
+ acc[key] = se_AdditionalModelRequestFieldsValue(value, context);
1413
+ return acc;
1414
+ }, {});
1415
+ }, "se_AdditionalModelRequestFields");
1416
+ var se_AdditionalModelRequestFieldsValue = /* @__PURE__ */ __name((input, context) => {
1417
+ return input;
1418
+ }, "se_AdditionalModelRequestFieldsValue");
1401
1419
  var se_ByteContentDoc = /* @__PURE__ */ __name((input, context) => {
1402
1420
  return (0, import_smithy_client.take)(input, {
1403
1421
  contentType: [],
@@ -1417,9 +1435,17 @@ var se_ExternalSources = /* @__PURE__ */ __name((input, context) => {
1417
1435
  return se_ExternalSource(entry, context);
1418
1436
  });
1419
1437
  }, "se_ExternalSources");
1438
+ var se_ExternalSourcesGenerationConfiguration = /* @__PURE__ */ __name((input, context) => {
1439
+ return (0, import_smithy_client.take)(input, {
1440
+ additionalModelRequestFields: (_) => se_AdditionalModelRequestFields(_, context),
1441
+ guardrailConfiguration: import_smithy_client._json,
1442
+ inferenceConfig: (_) => se_InferenceConfig(_, context),
1443
+ promptTemplate: import_smithy_client._json
1444
+ });
1445
+ }, "se_ExternalSourcesGenerationConfiguration");
1420
1446
  var se_ExternalSourcesRetrieveAndGenerateConfiguration = /* @__PURE__ */ __name((input, context) => {
1421
1447
  return (0, import_smithy_client.take)(input, {
1422
- generationConfiguration: import_smithy_client._json,
1448
+ generationConfiguration: (_) => se_ExternalSourcesGenerationConfiguration(_, context),
1423
1449
  modelArn: [],
1424
1450
  sources: (_) => se_ExternalSources(_, context)
1425
1451
  });
@@ -1433,6 +1459,19 @@ var se_FilterAttribute = /* @__PURE__ */ __name((input, context) => {
1433
1459
  var se_FilterValue = /* @__PURE__ */ __name((input, context) => {
1434
1460
  return input;
1435
1461
  }, "se_FilterValue");
1462
+ var se_GenerationConfiguration = /* @__PURE__ */ __name((input, context) => {
1463
+ return (0, import_smithy_client.take)(input, {
1464
+ additionalModelRequestFields: (_) => se_AdditionalModelRequestFields(_, context),
1465
+ guardrailConfiguration: import_smithy_client._json,
1466
+ inferenceConfig: (_) => se_InferenceConfig(_, context),
1467
+ promptTemplate: import_smithy_client._json
1468
+ });
1469
+ }, "se_GenerationConfiguration");
1470
+ var se_InferenceConfig = /* @__PURE__ */ __name((input, context) => {
1471
+ return (0, import_smithy_client.take)(input, {
1472
+ textInferenceConfig: (_) => se_TextInferenceConfig(_, context)
1473
+ });
1474
+ }, "se_InferenceConfig");
1436
1475
  var se_KnowledgeBaseRetrievalConfiguration = /* @__PURE__ */ __name((input, context) => {
1437
1476
  return (0, import_smithy_client.take)(input, {
1438
1477
  vectorSearchConfiguration: (_) => se_KnowledgeBaseVectorSearchConfiguration(_, context)
@@ -1440,7 +1479,7 @@ var se_KnowledgeBaseRetrievalConfiguration = /* @__PURE__ */ __name((input, cont
1440
1479
  }, "se_KnowledgeBaseRetrievalConfiguration");
1441
1480
  var se_KnowledgeBaseRetrieveAndGenerateConfiguration = /* @__PURE__ */ __name((input, context) => {
1442
1481
  return (0, import_smithy_client.take)(input, {
1443
- generationConfiguration: import_smithy_client._json,
1482
+ generationConfiguration: (_) => se_GenerationConfiguration(_, context),
1444
1483
  knowledgeBaseId: [],
1445
1484
  modelArn: [],
1446
1485
  retrievalConfiguration: (_) => se_KnowledgeBaseRetrievalConfiguration(_, context)
@@ -1481,6 +1520,14 @@ var se_RetrieveAndGenerateConfiguration = /* @__PURE__ */ __name((input, context
1481
1520
  type: []
1482
1521
  });
1483
1522
  }, "se_RetrieveAndGenerateConfiguration");
1523
+ var se_TextInferenceConfig = /* @__PURE__ */ __name((input, context) => {
1524
+ return (0, import_smithy_client.take)(input, {
1525
+ maxTokens: [],
1526
+ stopSequences: import_smithy_client._json,
1527
+ temperature: import_smithy_client.serializeFloat,
1528
+ topP: import_smithy_client.serializeFloat
1529
+ });
1530
+ }, "se_TextInferenceConfig");
1484
1531
  var de_Attribution = /* @__PURE__ */ __name((output, context) => {
1485
1532
  return (0, import_smithy_client.take)(output, {
1486
1533
  citations: (_) => de_Citations(_, context)
@@ -1777,6 +1824,7 @@ var paginateRetrieve = (0, import_core.createPaginator)(BedrockAgentRuntimeClien
1777
1824
  ExternalSourceType,
1778
1825
  SearchType,
1779
1826
  RetrieveAndGenerateType,
1827
+ GuadrailAction,
1780
1828
  RetrievalFilter,
1781
1829
  ActionGroupInvocationInputFilterSensitiveLog,
1782
1830
  ActionGroupInvocationOutputFilterSensitiveLog,
@@ -254,6 +254,10 @@ export const RetrieveAndGenerateType = {
254
254
  EXTERNAL_SOURCES: "EXTERNAL_SOURCES",
255
255
  KNOWLEDGE_BASE: "KNOWLEDGE_BASE",
256
256
  };
257
+ export const GuadrailAction = {
258
+ INTERVENED: "INTERVENED",
259
+ NONE: "NONE",
260
+ };
257
261
  export var RetrievalFilter;
258
262
  (function (RetrievalFilter) {
259
263
  RetrievalFilter.visit = (value, visitor) => {
@@ -1,6 +1,6 @@
1
1
  import { awsExpectUnion as __expectUnion, loadRestJsonErrorCode, parseJsonBody as parseBody, parseJsonErrorBody as parseErrorBody, } from "@aws-sdk/core";
2
2
  import { requestBuilder as rb } from "@smithy/core";
3
- import { _json, collectBody, decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, limitedParseDouble as __limitedParseDouble, limitedParseFloat32 as __limitedParseFloat32, map, take, withBaseException, } from "@smithy/smithy-client";
3
+ import { _json, collectBody, decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, limitedParseDouble as __limitedParseDouble, limitedParseFloat32 as __limitedParseFloat32, map, serializeFloat as __serializeFloat, take, withBaseException, } from "@smithy/smithy-client";
4
4
  import { BedrockAgentRuntimeServiceException as __BaseException } from "../models/BedrockAgentRuntimeServiceException";
5
5
  import { AccessDeniedException, BadGatewayException, ConflictException, DependencyFailedException, InternalServerException, ResourceNotFoundException, RetrievalFilter, ServiceQuotaExceededException, ThrottlingException, ValidationException, } from "../models/models_0";
6
6
  export const se_InvokeAgentCommand = async (input, context) => {
@@ -92,6 +92,7 @@ export const de_RetrieveAndGenerateCommand = async (output, context) => {
92
92
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
93
93
  const doc = take(data, {
94
94
  citations: (_) => de_Citations(_, context),
95
+ guardrailAction: __expectString,
95
96
  output: _json,
96
97
  sessionId: __expectString,
97
98
  });
@@ -407,6 +408,18 @@ const de_ValidationException_event = async (output, context) => {
407
408
  };
408
409
  return de_ValidationExceptionRes(parsedOutput, context);
409
410
  };
411
+ const se_AdditionalModelRequestFields = (input, context) => {
412
+ return Object.entries(input).reduce((acc, [key, value]) => {
413
+ if (value === null) {
414
+ return acc;
415
+ }
416
+ acc[key] = se_AdditionalModelRequestFieldsValue(value, context);
417
+ return acc;
418
+ }, {});
419
+ };
420
+ const se_AdditionalModelRequestFieldsValue = (input, context) => {
421
+ return input;
422
+ };
410
423
  const se_ByteContentDoc = (input, context) => {
411
424
  return take(input, {
412
425
  contentType: [],
@@ -428,9 +441,17 @@ const se_ExternalSources = (input, context) => {
428
441
  return se_ExternalSource(entry, context);
429
442
  });
430
443
  };
444
+ const se_ExternalSourcesGenerationConfiguration = (input, context) => {
445
+ return take(input, {
446
+ additionalModelRequestFields: (_) => se_AdditionalModelRequestFields(_, context),
447
+ guardrailConfiguration: _json,
448
+ inferenceConfig: (_) => se_InferenceConfig(_, context),
449
+ promptTemplate: _json,
450
+ });
451
+ };
431
452
  const se_ExternalSourcesRetrieveAndGenerateConfiguration = (input, context) => {
432
453
  return take(input, {
433
- generationConfiguration: _json,
454
+ generationConfiguration: (_) => se_ExternalSourcesGenerationConfiguration(_, context),
434
455
  modelArn: [],
435
456
  sources: (_) => se_ExternalSources(_, context),
436
457
  });
@@ -444,6 +465,19 @@ const se_FilterAttribute = (input, context) => {
444
465
  const se_FilterValue = (input, context) => {
445
466
  return input;
446
467
  };
468
+ const se_GenerationConfiguration = (input, context) => {
469
+ return take(input, {
470
+ additionalModelRequestFields: (_) => se_AdditionalModelRequestFields(_, context),
471
+ guardrailConfiguration: _json,
472
+ inferenceConfig: (_) => se_InferenceConfig(_, context),
473
+ promptTemplate: _json,
474
+ });
475
+ };
476
+ const se_InferenceConfig = (input, context) => {
477
+ return take(input, {
478
+ textInferenceConfig: (_) => se_TextInferenceConfig(_, context),
479
+ });
480
+ };
447
481
  const se_KnowledgeBaseRetrievalConfiguration = (input, context) => {
448
482
  return take(input, {
449
483
  vectorSearchConfiguration: (_) => se_KnowledgeBaseVectorSearchConfiguration(_, context),
@@ -451,7 +485,7 @@ const se_KnowledgeBaseRetrievalConfiguration = (input, context) => {
451
485
  };
452
486
  const se_KnowledgeBaseRetrieveAndGenerateConfiguration = (input, context) => {
453
487
  return take(input, {
454
- generationConfiguration: _json,
488
+ generationConfiguration: (_) => se_GenerationConfiguration(_, context),
455
489
  knowledgeBaseId: [],
456
490
  modelArn: [],
457
491
  retrievalConfiguration: (_) => se_KnowledgeBaseRetrievalConfiguration(_, context),
@@ -494,6 +528,14 @@ const se_RetrieveAndGenerateConfiguration = (input, context) => {
494
528
  type: [],
495
529
  });
496
530
  };
531
+ const se_TextInferenceConfig = (input, context) => {
532
+ return take(input, {
533
+ maxTokens: [],
534
+ stopSequences: _json,
535
+ temperature: __serializeFloat,
536
+ topP: __serializeFloat,
537
+ });
538
+ };
497
539
  const de_Attribution = (output, context) => {
498
540
  return take(output, {
499
541
  citations: (_) => de_Citations(_, context),
@@ -26,10 +26,10 @@ declare const InvokeAgentCommand_base: {
26
26
  getEndpointParameterInstructions(): import("@smithy/middleware-endpoint").EndpointParameterInstructions;
27
27
  };
28
28
  /**
29
- * <p>Sends a prompt for the agent to process and respond to. Use return control event type for function calling.</p>
30
- * <note>
29
+ * <note>
31
30
  * <p>The CLI doesn't support <code>InvokeAgent</code>.</p>
32
31
  * </note>
32
+ * <p>Sends a prompt for the agent to process and respond to. Note the following fields for the request:</p>
33
33
  * <ul>
34
34
  * <li>
35
35
  * <p>To continue the same conversation with an agent, use the same <code>sessionId</code> value in the request.</p>
@@ -41,10 +41,7 @@ declare const InvokeAgentCommand_base: {
41
41
  * <p>End a conversation by setting <code>endSession</code> to <code>true</code>.</p>
42
42
  * </li>
43
43
  * <li>
44
- * <p>In the <code>sessionState</code> object, you can include attributes for the session or prompt or parameters returned from the action group.</p>
45
- * </li>
46
- * <li>
47
- * <p>Use return control event type for function calling.</p>
44
+ * <p>In the <code>sessionState</code> object, you can include attributes for the session or prompt or, if you configured an action group to return control, results from invocation of the action group.</p>
48
45
  * </li>
49
46
  * </ul>
50
47
  * <p>The response is returned in the <code>bytes</code> field of the <code>chunk</code> object.</p>
@@ -56,6 +53,9 @@ declare const InvokeAgentCommand_base: {
56
53
  * <p>If you set <code>enableTrace</code> to <code>true</code> in the request, you can trace the agent's steps and reasoning process that led it to the response.</p>
57
54
  * </li>
58
55
  * <li>
56
+ * <p>If the action predicted was configured to return control, the response returns parameters for the action, elicited from the user, in the <code>returnControl</code> field.</p>
57
+ * </li>
58
+ * <li>
59
59
  * <p>Errors are also surfaced in the response.</p>
60
60
  * </li>
61
61
  * </ul>
@@ -101,6 +101,23 @@ declare const RetrieveAndGenerateCommand_base: {
101
101
  * promptTemplate: { // PromptTemplate
102
102
  * textPromptTemplate: "STRING_VALUE",
103
103
  * },
104
+ * guardrailConfiguration: { // GuardrailConfiguration
105
+ * guardrailId: "STRING_VALUE", // required
106
+ * guardrailVersion: "STRING_VALUE", // required
107
+ * },
108
+ * inferenceConfig: { // InferenceConfig
109
+ * textInferenceConfig: { // TextInferenceConfig
110
+ * temperature: Number("float"),
111
+ * topP: Number("float"),
112
+ * maxTokens: Number("int"),
113
+ * stopSequences: [ // RAGStopSequences
114
+ * "STRING_VALUE",
115
+ * ],
116
+ * },
117
+ * },
118
+ * additionalModelRequestFields: { // AdditionalModelRequestFields
119
+ * "<keys>": "DOCUMENT_VALUE",
120
+ * },
104
121
  * },
105
122
  * },
106
123
  * externalSourcesConfiguration: { // ExternalSourcesRetrieveAndGenerateConfiguration
@@ -122,6 +139,23 @@ declare const RetrieveAndGenerateCommand_base: {
122
139
  * promptTemplate: {
123
140
  * textPromptTemplate: "STRING_VALUE",
124
141
  * },
142
+ * guardrailConfiguration: {
143
+ * guardrailId: "STRING_VALUE", // required
144
+ * guardrailVersion: "STRING_VALUE", // required
145
+ * },
146
+ * inferenceConfig: {
147
+ * textInferenceConfig: {
148
+ * temperature: Number("float"),
149
+ * topP: Number("float"),
150
+ * maxTokens: Number("int"),
151
+ * stopSequences: [
152
+ * "STRING_VALUE",
153
+ * ],
154
+ * },
155
+ * },
156
+ * additionalModelRequestFields: {
157
+ * "<keys>": "DOCUMENT_VALUE",
158
+ * },
125
159
  * },
126
160
  * },
127
161
  * },
@@ -165,6 +199,7 @@ declare const RetrieveAndGenerateCommand_base: {
165
199
  * // ],
166
200
  * // },
167
201
  * // ],
202
+ * // guardrailAction: "INTERVENED" || "NONE",
168
203
  * // };
169
204
  *
170
205
  * ```
@@ -155,7 +155,7 @@ export declare class InternalServerException extends __BaseException {
155
155
  * <p>This data type is used in the following API operations:</p>
156
156
  * <ul>
157
157
  * <li>
158
- * <p>In the <code>returnControlInvocationResults</code> field of the <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html#API_agent-runtime_Retrieve_RequestSyntax">Retrieve request</a>
158
+ * <p>In the <code>returnControlInvocationResults</code> field of the <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_InvokeAgent.html#API_agent-runtime_InvokeAgent_RequestSyntax">InvokeAgent request</a>
159
159
  * </p>
160
160
  * </li>
161
161
  * </ul>
@@ -185,7 +185,7 @@ export type ResponseState = (typeof ResponseState)[keyof typeof ResponseState];
185
185
  * <p>This data type is used in the following API operations:</p>
186
186
  * <ul>
187
187
  * <li>
188
- * <p>In the <code>returnControlInvocationResults</code> of the <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html#API_agent-runtime_Retrieve_RequestSyntax">Retrieve request</a>
188
+ * <p>In the <code>returnControlInvocationResults</code> of the <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_InvokeAgent.html#API_agent-runtime_InvokeAgent_RequestSyntax">InvokeAgent request</a>
189
189
  * </p>
190
190
  * </li>
191
191
  * </ul>
@@ -208,7 +208,7 @@ export interface ApiResult {
208
208
  */
209
209
  apiPath?: string;
210
210
  /**
211
- * <p>The response body from the API operation. The key of the object is the content type. The response may be returned directly or from the Lambda function.</p>
211
+ * <p>The response body from the API operation. The key of the object is the content type (currently, only <code>TEXT</code> is supported). The response may be returned directly or from the Lambda function.</p>
212
212
  * @public
213
213
  */
214
214
  responseBody?: Record<string, ContentBody>;
@@ -228,7 +228,7 @@ export interface ApiResult {
228
228
  * <p>This data type is used in the following API operations:</p>
229
229
  * <ul>
230
230
  * <li>
231
- * <p>In the <code>returnControlInvocationResults</code> of the <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html#API_agent-runtime_Retrieve_RequestSyntax">Retrieve request</a>
231
+ * <p>In the <code>returnControlInvocationResults</code> of the <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_InvokeAgent.html#API_agent-runtime_InvokeAgent_RequestSyntax">InvokeAgent request</a>
232
232
  * </p>
233
233
  * </li>
234
234
  * </ul>
@@ -246,7 +246,7 @@ export interface FunctionResult {
246
246
  */
247
247
  function?: string;
248
248
  /**
249
- * <p>The response from the function call using the parameters. The response may be returned directly or from the Lambda function.</p>
249
+ * <p>The response from the function call using the parameters. The key of the object is the content type (currently, only <code>TEXT</code> is supported). The response may be returned directly or from the Lambda function.</p>
250
250
  * @public
251
251
  */
252
252
  responseBody?: Record<string, ContentBody>;
@@ -257,12 +257,12 @@ export interface FunctionResult {
257
257
  responseState?: ResponseState;
258
258
  }
259
259
  /**
260
- * <p>A result from the action group invocation.</p>
260
+ * <p>A result from the invocation of an action. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/agents-returncontrol.html">Return control to the agent developer</a> and <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/agents-session-state.html">Control session context</a>.</p>
261
261
  * <p>This data type is used in the following API operations:</p>
262
262
  * <ul>
263
263
  * <li>
264
264
  * <p>
265
- * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html#API_agent-runtime_Retrieve_RequestSyntax">Retrieve request</a>
265
+ * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_InvokeAgent.html#API_agent-runtime_InvokeAgent_RequestSyntax">InvokeAgent request</a>
266
266
  * </p>
267
267
  * </li>
268
268
  * </ul>
@@ -322,12 +322,15 @@ export interface SessionState {
322
322
  */
323
323
  promptSessionAttributes?: Record<string, string>;
324
324
  /**
325
- * <p>Contains information about the results from the action group invocation.</p>
325
+ * <p>Contains information about the results from the action group invocation. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/agents-returncontrol.html">Return control to the agent developer</a> and <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/agents-session-state.html">Control session context</a>.</p>
326
+ * <note>
327
+ * <p>If you include this field, the <code>inputText</code> field will be ignored.</p>
328
+ * </note>
326
329
  * @public
327
330
  */
328
331
  returnControlInvocationResults?: InvocationResultMember[];
329
332
  /**
330
- * <p>The identifier of the invocation.</p>
333
+ * <p>The identifier of the invocation of an action. This value must match the <code>invocationId</code> returned in the <code>InvokeAgent</code> response for the action whose results are provided in the <code>returnControlInvocationResults</code> field. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/agents-returncontrol.html">Return control to the agent developer</a> and <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/agents-session-state.html">Control session context</a>.</p>
331
334
  * @public
332
335
  */
333
336
  invocationId?: string;
@@ -338,6 +341,9 @@ export interface SessionState {
338
341
  export interface InvokeAgentRequest {
339
342
  /**
340
343
  * <p>Contains parameters that specify various attributes of the session. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/agents-session-state.html">Control session context</a>.</p>
344
+ * <note>
345
+ * <p>If you include <code>returnControlInvocationResults</code> in the <code>sessionState</code> field, the <code>inputText</code> field will be ignored.</p>
346
+ * </note>
341
347
  * @public
342
348
  */
343
349
  sessionState?: SessionState;
@@ -368,6 +374,9 @@ export interface InvokeAgentRequest {
368
374
  enableTrace?: boolean;
369
375
  /**
370
376
  * <p>The prompt text to send the agent.</p>
377
+ * <note>
378
+ * <p>If you include <code>returnControlInvocationResults</code> in the <code>sessionState</code> field, the <code>inputText</code> field will be ignored.</p>
379
+ * </note>
371
380
  * @public
372
381
  */
373
382
  inputText?: string;
@@ -382,7 +391,7 @@ export interface InvokeAgentRequest {
382
391
  * </li>
383
392
  * <li>
384
393
  * <p>
385
- * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html#API_agent-runtime_Retrieve_ResponseSyntax">Retrieve response</a> – in the <code>span</code> field</p>
394
+ * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_InvokeAgent.html#API_agent-runtime_InvokeAgent_ResponseSyntax">InvokeAgent response</a> – in the <code>span</code> field</p>
386
395
  * </li>
387
396
  * </ul>
388
397
  * @public
@@ -409,7 +418,7 @@ export interface Span {
409
418
  * </li>
410
419
  * <li>
411
420
  * <p>
412
- * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html#API_agent-runtime_Retrieve_ResponseSyntax">Retrieve response</a> – in the <code>textResponsePart</code> field</p>
421
+ * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_InvokeAgent.html#API_agent-runtime_InvokeAgent_ResponseSyntax">InvokeAgent response</a> – in the <code>textResponsePart</code> field</p>
413
422
  * </li>
414
423
  * </ul>
415
424
  * @public
@@ -432,7 +441,7 @@ export interface TextResponsePart {
432
441
  * <ul>
433
442
  * <li>
434
443
  * <p>
435
- * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html#API_agent-runtime_Retrieve_ResponseSyntax">Retrieve response</a> – in the <code>generatedResponsePart</code> field</p>
444
+ * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_InvokeAgent.html#API_agent-runtime_InvokeAgent_ResponseSyntax">InvokeAgent response</a> – in the <code>generatedResponsePart</code> field</p>
436
445
  * </li>
437
446
  * <li>
438
447
  * <p>
@@ -462,7 +471,7 @@ export interface GeneratedResponsePart {
462
471
  * </li>
463
472
  * <li>
464
473
  * <p>
465
- * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html#API_agent-runtime_Retrieve_ResponseSyntax">Retrieve response</a> – in the <code>content</code> field</p>
474
+ * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_InvokeAgent.html#API_agent-runtime_InvokeAgent_ResponseSyntax">InvokeAgent response</a> – in the <code>content</code> field</p>
466
475
  * </li>
467
476
  * </ul>
468
477
  * @public
@@ -488,7 +497,7 @@ export interface RetrievalResultContent {
488
497
  * </li>
489
498
  * <li>
490
499
  * <p>
491
- * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html#API_agent-runtime_Retrieve_ResponseSyntax">Retrieve response</a> – in the <code>s3Location</code> field</p>
500
+ * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_InvokeAgent.html#API_agent-runtime_InvokeAgent_ResponseSyntax">InvokeAgent response</a> – in the <code>s3Location</code> field</p>
492
501
  * </li>
493
502
  * </ul>
494
503
  * @public
@@ -525,7 +534,7 @@ export type RetrievalResultLocationType = (typeof RetrievalResultLocationType)[k
525
534
  * </li>
526
535
  * <li>
527
536
  * <p>
528
- * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html#API_agent-runtime_Retrieve_ResponseSyntax">Retrieve response</a> – in the <code>locatino</code> field</p>
537
+ * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_InvokeAgent.html#API_agent-runtime_InvokeAgent_ResponseSyntax">InvokeAgent response</a> – in the <code>locatino</code> field</p>
529
538
  * </li>
530
539
  * </ul>
531
540
  * @public
@@ -552,7 +561,7 @@ export interface RetrievalResultLocation {
552
561
  * </li>
553
562
  * <li>
554
563
  * <p>
555
- * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html#API_agent-runtime_Retrieve_ResponseSyntax">Retrieve response</a> – in the <code>retrievedReferences</code> field</p>
564
+ * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_InvokeAgent.html#API_agent-runtime_InvokeAgent_ResponseSyntax">InvokeAgent response</a> – in the <code>retrievedReferences</code> field</p>
556
565
  * </li>
557
566
  * </ul>
558
567
  * @public
@@ -580,7 +589,7 @@ export interface RetrievedReference {
580
589
  * <ul>
581
590
  * <li>
582
591
  * <p>
583
- * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html#API_agent-runtime_Retrieve_ResponseSyntax">Retrieve response</a> – in the <code>citations</code> field</p>
592
+ * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_InvokeAgent.html#API_agent-runtime_InvokeAgent_ResponseSyntax">InvokeAgent response</a> – in the <code>citations</code> field</p>
584
593
  * </li>
585
594
  * <li>
586
595
  * <p>
@@ -646,7 +655,7 @@ export declare class ResourceNotFoundException extends __BaseException {
646
655
  * <ul>
647
656
  * <li>
648
657
  * <p>
649
- * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html#API_agent-runtime_Retrieve_ResponseSyntax">Retrieve response</a>
658
+ * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_InvokeAgent.html#API_agent-runtime_InvokeAgent_ResponseSyntax">InvokeAgent response</a>
650
659
  * </p>
651
660
  * </li>
652
661
  * </ul>
@@ -686,7 +695,7 @@ export interface PropertyParameters {
686
695
  * <ul>
687
696
  * <li>
688
697
  * <p>
689
- * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html#API_agent-runtime_Retrieve_ResponseSyntax">Retrieve response</a>
698
+ * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_InvokeAgent.html#API_agent-runtime_InvokeAgent_ResponseSyntax">InvokeAgent response</a>
690
699
  * </p>
691
700
  * </li>
692
701
  * </ul>
@@ -704,7 +713,7 @@ export interface ApiRequestBody {
704
713
  * <p>This data type is used in the following API operations:</p>
705
714
  * <ul>
706
715
  * <li>
707
- * <p>In the <code>returnControl</code> field of the <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html#API_agent-runtime_Retrieve_ResponseSyntax">Retrieve response</a>
716
+ * <p>In the <code>returnControl</code> field of the <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_InvokeAgent.html#API_agent-runtime_InvokeAgent_ResponseSyntax">InvokeAgent response</a>
708
717
  * </p>
709
718
  * </li>
710
719
  * </ul>
@@ -742,7 +751,7 @@ export interface ApiInvocationInput {
742
751
  * <p>This data type is used in the following API operations:</p>
743
752
  * <ul>
744
753
  * <li>
745
- * <p>In the <code>returnControl</code> field of the <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html#API_agent-runtime_Retrieve_ResponseSyntax">Retrieve response</a>
754
+ * <p>In the <code>returnControl</code> field of the <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_InvokeAgent.html#API_agent-runtime_InvokeAgent_ResponseSyntax">InvokeAgent response</a>
746
755
  * </p>
747
756
  * </li>
748
757
  * </ul>
@@ -770,7 +779,7 @@ export interface FunctionParameter {
770
779
  * <p>This data type is used in the following API operations:</p>
771
780
  * <ul>
772
781
  * <li>
773
- * <p>In the <code>returnControl</code> field of the <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html#API_agent-runtime_Retrieve_ResponseSyntax">Retrieve response</a>
782
+ * <p>In the <code>returnControl</code> field of the <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_InvokeAgent.html#API_agent-runtime_InvokeAgent_ResponseSyntax">InvokeAgent response</a>
774
783
  * </p>
775
784
  * </li>
776
785
  * </ul>
@@ -794,11 +803,11 @@ export interface FunctionInvocationInput {
794
803
  function?: string;
795
804
  }
796
805
  /**
797
- * <p>Contains details about the API operation or function that the agent predicts should be called.</p>
806
+ * <p>Contains details about the API operation or function that the agent predicts should be called. </p>
798
807
  * <p>This data type is used in the following API operations:</p>
799
808
  * <ul>
800
809
  * <li>
801
- * <p>In the <code>returnControl</code> field of the <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html#API_agent-runtime_Retrieve_ResponseSyntax">Retrieve response</a>
810
+ * <p>In the <code>returnControl</code> field of the <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_InvokeAgent.html#API_agent-runtime_InvokeAgent_ResponseSyntax">InvokeAgent response</a>
802
811
  * </p>
803
812
  * </li>
804
813
  * </ul>
@@ -848,7 +857,7 @@ export declare namespace InvocationInputMember {
848
857
  * <ul>
849
858
  * <li>
850
859
  * <p>
851
- * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html#API_agent-runtime_Retrieve_ResponseSyntax">Retrieve response</a>
860
+ * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_InvokeAgent.html#API_agent-runtime_InvokeAgent_ResponseSyntax">InvokeAgent response</a>
852
861
  * </p>
853
862
  * </li>
854
863
  * </ul>
@@ -1883,6 +1892,72 @@ export interface RetrieveAndGenerateInput {
1883
1892
  */
1884
1893
  text: string | undefined;
1885
1894
  }
1895
+ /**
1896
+ * <p>The configuration details for the guardrail.</p>
1897
+ * @public
1898
+ */
1899
+ export interface GuardrailConfiguration {
1900
+ /**
1901
+ * <p>The unique identifier for the guardrail.</p>
1902
+ * @public
1903
+ */
1904
+ guardrailId: string | undefined;
1905
+ /**
1906
+ * <p>The version of the guardrail.</p>
1907
+ * @public
1908
+ */
1909
+ guardrailVersion: string | undefined;
1910
+ }
1911
+ /**
1912
+ * <p>Configuration settings for text generation using a language model via the
1913
+ * RetrieveAndGenerate operation. Includes parameters like temperature, top-p, maximum token
1914
+ * count, and stop sequences. </p>
1915
+ * <note>
1916
+ * <p>The valid range of <code>maxTokens</code> depends on the accepted values for your chosen
1917
+ * model's inference parameters. To see the inference parameters for your model, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html">Inference
1918
+ * parameters for foundation models.</a>
1919
+ * </p>
1920
+ * </note>
1921
+ * @public
1922
+ */
1923
+ export interface TextInferenceConfig {
1924
+ /**
1925
+ * <p> Controls the random-ness of text generated by the language model, influencing how much the model sticks to the most predictable next words versus exploring more surprising options. A lower temperature value (e.g. 0.2 or 0.3) makes model outputs more deterministic or predictable, while a higher temperature (e.g. 0.8 or 0.9) makes the outputs more creative or unpredictable. </p>
1926
+ * @public
1927
+ */
1928
+ temperature?: number;
1929
+ /**
1930
+ * <p> A probability distribution threshold which controls what the model considers for the set of possible next tokens. The model will only consider the top p% of the probability distribution when generating the next token. </p>
1931
+ * @public
1932
+ */
1933
+ topP?: number;
1934
+ /**
1935
+ * <p>The maximum number of tokens to generate in the output text. Do not use the minimum of 0
1936
+ * or the maximum of 65536. The limit values described here are arbitary values, for actual
1937
+ * values consult the limits defined by your specific model.</p>
1938
+ * @public
1939
+ */
1940
+ maxTokens?: number;
1941
+ /**
1942
+ * <p>A list of sequences of characters that, if generated, will cause the model to stop
1943
+ * generating further tokens. Do not use a minimum length of 1 or a maximum length of 1000. The
1944
+ * limit values described here are arbitary values, for actual values consult the limits defined
1945
+ * by your specific model.</p>
1946
+ * @public
1947
+ */
1948
+ stopSequences?: string[];
1949
+ }
1950
+ /**
1951
+ * <p> The configuration for inference settings when generating responses using RetrieveAndGenerate. </p>
1952
+ * @public
1953
+ */
1954
+ export interface InferenceConfig {
1955
+ /**
1956
+ * <p> Configuration settings specific to text generation while generating responses using RetrieveAndGenerate. </p>
1957
+ * @public
1958
+ */
1959
+ textInferenceConfig?: TextInferenceConfig;
1960
+ }
1886
1961
  /**
1887
1962
  * <p>Contains the template for the prompt that's sent to the model for response generation. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/kb-test-config.html#kb-test-config-sysprompt">Knowledge base prompt templates</a>.</p>
1888
1963
  * <p>This data type is used in the following API operations:</p>
@@ -1924,6 +1999,21 @@ export interface ExternalSourcesGenerationConfiguration {
1924
1999
  * @public
1925
2000
  */
1926
2001
  promptTemplate?: PromptTemplate;
2002
+ /**
2003
+ * <p>The configuration details for the guardrail.</p>
2004
+ * @public
2005
+ */
2006
+ guardrailConfiguration?: GuardrailConfiguration;
2007
+ /**
2008
+ * <p> Configuration settings for inference when using RetrieveAndGenerate to generate responses while using an external source.</p>
2009
+ * @public
2010
+ */
2011
+ inferenceConfig?: InferenceConfig;
2012
+ /**
2013
+ * <p> Additional model parameters and their corresponding values not included in the textInferenceConfig structure for an external source. Takes in custom model parameters specific to the language model being used. </p>
2014
+ * @public
2015
+ */
2016
+ additionalModelRequestFields?: Record<string, __DocumentType>;
1927
2017
  }
1928
2018
  /**
1929
2019
  * <p>This property contains the document to chat with, along with its attributes.</p>
@@ -2029,6 +2119,21 @@ export interface GenerationConfiguration {
2029
2119
  * @public
2030
2120
  */
2031
2121
  promptTemplate?: PromptTemplate;
2122
+ /**
2123
+ * <p>The configuration details for the guardrail.</p>
2124
+ * @public
2125
+ */
2126
+ guardrailConfiguration?: GuardrailConfiguration;
2127
+ /**
2128
+ * <p> Configuration settings for inference when using RetrieveAndGenerate to generate responses while using a knowledge base as a source. </p>
2129
+ * @public
2130
+ */
2131
+ inferenceConfig?: InferenceConfig;
2132
+ /**
2133
+ * <p> Additional model parameters and corresponding values not included in the textInferenceConfig structure for a knowledge base. This allows users to provide custom model parameters specific to the language model being used. </p>
2134
+ * @public
2135
+ */
2136
+ additionalModelRequestFields?: Record<string, __DocumentType>;
2032
2137
  }
2033
2138
  /**
2034
2139
  * <p>Specifies the name that the metadata attribute must match and the value to which to compare the value of the metadata attribute. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/kb-test-config.html">Query configurations</a>.</p>
@@ -2096,6 +2201,18 @@ export interface RetrieveAndGenerateSessionConfiguration {
2096
2201
  */
2097
2202
  kmsKeyArn: string | undefined;
2098
2203
  }
2204
+ /**
2205
+ * @public
2206
+ * @enum
2207
+ */
2208
+ export declare const GuadrailAction: {
2209
+ readonly INTERVENED: "INTERVENED";
2210
+ readonly NONE: "NONE";
2211
+ };
2212
+ /**
2213
+ * @public
2214
+ */
2215
+ export type GuadrailAction = (typeof GuadrailAction)[keyof typeof GuadrailAction];
2099
2216
  /**
2100
2217
  * <p>Contains the response generated from querying the knowledge base.</p>
2101
2218
  * <p>This data type is used in the following API operations:</p>
@@ -2133,6 +2250,11 @@ export interface RetrieveAndGenerateResponse {
2133
2250
  * @public
2134
2251
  */
2135
2252
  citations?: Citation[];
2253
+ /**
2254
+ * <p>Specifies if there is a guardrail intervention in the response.</p>
2255
+ * @public
2256
+ */
2257
+ guardrailAction?: GuadrailAction;
2136
2258
  }
2137
2259
  /**
2138
2260
  * <p>Contains the query made to the knowledge base.</p>
@@ -746,11 +746,27 @@ export interface InvokeAgentResponse {
746
746
  export interface RetrieveAndGenerateInput {
747
747
  text: string | undefined;
748
748
  }
749
+ export interface GuardrailConfiguration {
750
+ guardrailId: string | undefined;
751
+ guardrailVersion: string | undefined;
752
+ }
753
+ export interface TextInferenceConfig {
754
+ temperature?: number;
755
+ topP?: number;
756
+ maxTokens?: number;
757
+ stopSequences?: string[];
758
+ }
759
+ export interface InferenceConfig {
760
+ textInferenceConfig?: TextInferenceConfig;
761
+ }
749
762
  export interface PromptTemplate {
750
763
  textPromptTemplate?: string;
751
764
  }
752
765
  export interface ExternalSourcesGenerationConfiguration {
753
766
  promptTemplate?: PromptTemplate;
767
+ guardrailConfiguration?: GuardrailConfiguration;
768
+ inferenceConfig?: InferenceConfig;
769
+ additionalModelRequestFields?: Record<string, __DocumentType>;
754
770
  }
755
771
  export interface ByteContentDoc {
756
772
  identifier: string | undefined;
@@ -778,6 +794,9 @@ export interface ExternalSourcesRetrieveAndGenerateConfiguration {
778
794
  }
779
795
  export interface GenerationConfiguration {
780
796
  promptTemplate?: PromptTemplate;
797
+ guardrailConfiguration?: GuardrailConfiguration;
798
+ inferenceConfig?: InferenceConfig;
799
+ additionalModelRequestFields?: Record<string, __DocumentType>;
781
800
  }
782
801
  export interface FilterAttribute {
783
802
  key: string | undefined;
@@ -797,6 +816,12 @@ export type RetrieveAndGenerateType =
797
816
  export interface RetrieveAndGenerateSessionConfiguration {
798
817
  kmsKeyArn: string | undefined;
799
818
  }
819
+ export declare const GuadrailAction: {
820
+ readonly INTERVENED: "INTERVENED";
821
+ readonly NONE: "NONE";
822
+ };
823
+ export type GuadrailAction =
824
+ (typeof GuadrailAction)[keyof typeof GuadrailAction];
800
825
  export interface RetrieveAndGenerateOutput {
801
826
  text: string | undefined;
802
827
  }
@@ -804,6 +829,7 @@ export interface RetrieveAndGenerateResponse {
804
829
  sessionId: string | undefined;
805
830
  output: RetrieveAndGenerateOutput | undefined;
806
831
  citations?: Citation[];
832
+ guardrailAction?: GuadrailAction;
807
833
  }
808
834
  export interface KnowledgeBaseQuery {
809
835
  text: string | undefined;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-bedrock-agent-runtime",
3
3
  "description": "AWS SDK for JavaScript Bedrock Agent Runtime Client for Node.js, Browser and React Native",
4
- "version": "3.572.0",
4
+ "version": "3.574.0",
5
5
  "scripts": {
6
6
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
7
7
  "build:cjs": "node ../../scripts/compilation/inline client-bedrock-agent-runtime",
@@ -20,8 +20,8 @@
20
20
  "dependencies": {
21
21
  "@aws-crypto/sha256-browser": "3.0.0",
22
22
  "@aws-crypto/sha256-js": "3.0.0",
23
- "@aws-sdk/client-sso-oidc": "3.572.0",
24
- "@aws-sdk/client-sts": "3.572.0",
23
+ "@aws-sdk/client-sso-oidc": "3.574.0",
24
+ "@aws-sdk/client-sts": "3.574.0",
25
25
  "@aws-sdk/core": "3.572.0",
26
26
  "@aws-sdk/credential-provider-node": "3.572.0",
27
27
  "@aws-sdk/middleware-host-header": "3.567.0",