@aws-sdk/client-bedrock-agent-runtime 3.701.0 → 3.703.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 +16 -0
- package/dist-cjs/index.js +530 -3
- package/dist-es/BedrockAgentRuntime.js +4 -0
- package/dist-es/commands/RerankCommand.js +23 -0
- package/dist-es/commands/RetrieveAndGenerateStreamCommand.js +27 -0
- package/dist-es/commands/index.js +2 -0
- package/dist-es/models/models_0.js +180 -0
- package/dist-es/pagination/RerankPaginator.js +4 -0
- package/dist-es/pagination/index.js +1 -0
- package/dist-es/protocols/Aws_restJson1.js +231 -0
- package/dist-types/BedrockAgentRuntime.d.ts +14 -0
- package/dist-types/BedrockAgentRuntimeClient.d.ts +4 -2
- package/dist-types/commands/InvokeAgentCommand.d.ts +45 -2
- package/dist-types/commands/InvokeInlineAgentCommand.d.ts +45 -2
- package/dist-types/commands/RerankCommand.d.ts +143 -0
- package/dist-types/commands/RetrieveAndGenerateCommand.d.ts +42 -2
- package/dist-types/commands/RetrieveAndGenerateStreamCommand.d.ts +371 -0
- package/dist-types/commands/RetrieveCommand.d.ts +46 -1
- package/dist-types/commands/index.d.ts +2 -0
- package/dist-types/models/models_0.d.ts +1038 -166
- package/dist-types/pagination/RerankPaginator.d.ts +7 -0
- package/dist-types/pagination/index.d.ts +1 -0
- package/dist-types/protocols/Aws_restJson1.d.ts +18 -0
- package/dist-types/ts3.4/BedrockAgentRuntime.d.ts +34 -0
- package/dist-types/ts3.4/BedrockAgentRuntimeClient.d.ts +12 -0
- package/dist-types/ts3.4/commands/RerankCommand.d.ts +41 -0
- package/dist-types/ts3.4/commands/RetrieveAndGenerateStreamCommand.d.ts +51 -0
- package/dist-types/ts3.4/commands/index.d.ts +2 -0
- package/dist-types/ts3.4/models/models_0.d.ts +455 -0
- package/dist-types/ts3.4/pagination/RerankPaginator.d.ts +11 -0
- package/dist-types/ts3.4/pagination/index.d.ts +1 -0
- package/dist-types/ts3.4/protocols/Aws_restJson1.d.ts +24 -0
- package/package.json +1 -1
|
@@ -6,7 +6,9 @@ import { InvokeAgentCommand } from "./commands/InvokeAgentCommand";
|
|
|
6
6
|
import { InvokeFlowCommand } from "./commands/InvokeFlowCommand";
|
|
7
7
|
import { InvokeInlineAgentCommand, } from "./commands/InvokeInlineAgentCommand";
|
|
8
8
|
import { OptimizePromptCommand, } from "./commands/OptimizePromptCommand";
|
|
9
|
+
import { RerankCommand } from "./commands/RerankCommand";
|
|
9
10
|
import { RetrieveAndGenerateCommand, } from "./commands/RetrieveAndGenerateCommand";
|
|
11
|
+
import { RetrieveAndGenerateStreamCommand, } from "./commands/RetrieveAndGenerateStreamCommand";
|
|
10
12
|
import { RetrieveCommand } from "./commands/RetrieveCommand";
|
|
11
13
|
const commands = {
|
|
12
14
|
DeleteAgentMemoryCommand,
|
|
@@ -15,8 +17,10 @@ const commands = {
|
|
|
15
17
|
InvokeFlowCommand,
|
|
16
18
|
InvokeInlineAgentCommand,
|
|
17
19
|
OptimizePromptCommand,
|
|
20
|
+
RerankCommand,
|
|
18
21
|
RetrieveCommand,
|
|
19
22
|
RetrieveAndGenerateCommand,
|
|
23
|
+
RetrieveAndGenerateStreamCommand,
|
|
20
24
|
};
|
|
21
25
|
export class BedrockAgentRuntime extends BedrockAgentRuntimeClient {
|
|
22
26
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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 { RerankRequestFilterSensitiveLog, RerankResponseFilterSensitiveLog, } from "../models/models_0";
|
|
6
|
+
import { de_RerankCommand, se_RerankCommand } from "../protocols/Aws_restJson1";
|
|
7
|
+
export { $Command };
|
|
8
|
+
export class RerankCommand 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", "Rerank", {})
|
|
18
|
+
.n("BedrockAgentRuntimeClient", "RerankCommand")
|
|
19
|
+
.f(RerankRequestFilterSensitiveLog, RerankResponseFilterSensitiveLog)
|
|
20
|
+
.ser(se_RerankCommand)
|
|
21
|
+
.de(de_RerankCommand)
|
|
22
|
+
.build() {
|
|
23
|
+
}
|
|
@@ -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 { RetrieveAndGenerateStreamRequestFilterSensitiveLog, RetrieveAndGenerateStreamResponseFilterSensitiveLog, } from "../models/models_0";
|
|
6
|
+
import { de_RetrieveAndGenerateStreamCommand, se_RetrieveAndGenerateStreamCommand } from "../protocols/Aws_restJson1";
|
|
7
|
+
export { $Command };
|
|
8
|
+
export class RetrieveAndGenerateStreamCommand 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", "RetrieveAndGenerateStream", {
|
|
18
|
+
eventStream: {
|
|
19
|
+
output: true,
|
|
20
|
+
},
|
|
21
|
+
})
|
|
22
|
+
.n("BedrockAgentRuntimeClient", "RetrieveAndGenerateStreamCommand")
|
|
23
|
+
.f(RetrieveAndGenerateStreamRequestFilterSensitiveLog, RetrieveAndGenerateStreamResponseFilterSensitiveLog)
|
|
24
|
+
.ser(se_RetrieveAndGenerateStreamCommand)
|
|
25
|
+
.de(de_RetrieveAndGenerateStreamCommand)
|
|
26
|
+
.build() {
|
|
27
|
+
}
|
|
@@ -4,5 +4,7 @@ export * from "./InvokeAgentCommand";
|
|
|
4
4
|
export * from "./InvokeFlowCommand";
|
|
5
5
|
export * from "./InvokeInlineAgentCommand";
|
|
6
6
|
export * from "./OptimizePromptCommand";
|
|
7
|
+
export * from "./RerankCommand";
|
|
7
8
|
export * from "./RetrieveAndGenerateCommand";
|
|
9
|
+
export * from "./RetrieveAndGenerateStreamCommand";
|
|
8
10
|
export * from "./RetrieveCommand";
|
|
@@ -259,10 +259,33 @@ export const FileUseCase = {
|
|
|
259
259
|
CHAT: "CHAT",
|
|
260
260
|
CODE_INTERPRETER: "CODE_INTERPRETER",
|
|
261
261
|
};
|
|
262
|
+
export const AttributeType = {
|
|
263
|
+
BOOLEAN: "BOOLEAN",
|
|
264
|
+
NUMBER: "NUMBER",
|
|
265
|
+
STRING: "STRING",
|
|
266
|
+
STRING_LIST: "STRING_LIST",
|
|
267
|
+
};
|
|
262
268
|
export const SearchType = {
|
|
263
269
|
HYBRID: "HYBRID",
|
|
264
270
|
SEMANTIC: "SEMANTIC",
|
|
265
271
|
};
|
|
272
|
+
export const RerankingMetadataSelectionMode = {
|
|
273
|
+
ALL: "ALL",
|
|
274
|
+
SELECTIVE: "SELECTIVE",
|
|
275
|
+
};
|
|
276
|
+
export var RerankingMetadataSelectiveModeConfiguration;
|
|
277
|
+
(function (RerankingMetadataSelectiveModeConfiguration) {
|
|
278
|
+
RerankingMetadataSelectiveModeConfiguration.visit = (value, visitor) => {
|
|
279
|
+
if (value.fieldsToInclude !== undefined)
|
|
280
|
+
return visitor.fieldsToInclude(value.fieldsToInclude);
|
|
281
|
+
if (value.fieldsToExclude !== undefined)
|
|
282
|
+
return visitor.fieldsToExclude(value.fieldsToExclude);
|
|
283
|
+
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
284
|
+
};
|
|
285
|
+
})(RerankingMetadataSelectiveModeConfiguration || (RerankingMetadataSelectiveModeConfiguration = {}));
|
|
286
|
+
export const VectorSearchRerankingConfigurationType = {
|
|
287
|
+
BEDROCK_RERANKING_MODEL: "BEDROCK_RERANKING_MODEL",
|
|
288
|
+
};
|
|
266
289
|
export const ConfirmationState = {
|
|
267
290
|
CONFIRM: "CONFIRM",
|
|
268
291
|
DENY: "DENY",
|
|
@@ -283,6 +306,7 @@ export var InvocationResultMember;
|
|
|
283
306
|
})(InvocationResultMember || (InvocationResultMember = {}));
|
|
284
307
|
export const RetrievalResultLocationType = {
|
|
285
308
|
CONFLUENCE: "CONFLUENCE",
|
|
309
|
+
CUSTOM: "CUSTOM",
|
|
286
310
|
S3: "S3",
|
|
287
311
|
SALESFORCE: "SALESFORCE",
|
|
288
312
|
SHAREPOINT: "SHAREPOINT",
|
|
@@ -568,6 +592,19 @@ export var OptimizedPromptStream;
|
|
|
568
592
|
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
569
593
|
};
|
|
570
594
|
})(OptimizedPromptStream || (OptimizedPromptStream = {}));
|
|
595
|
+
export const RerankQueryContentType = {
|
|
596
|
+
TEXT: "TEXT",
|
|
597
|
+
};
|
|
598
|
+
export const RerankingConfigurationType = {
|
|
599
|
+
BEDROCK_RERANKING_MODEL: "BEDROCK_RERANKING_MODEL",
|
|
600
|
+
};
|
|
601
|
+
export const RerankDocumentType = {
|
|
602
|
+
JSON: "JSON",
|
|
603
|
+
TEXT: "TEXT",
|
|
604
|
+
};
|
|
605
|
+
export const RerankSourceType = {
|
|
606
|
+
INLINE: "INLINE",
|
|
607
|
+
};
|
|
571
608
|
export const ExternalSourceType = {
|
|
572
609
|
BYTE_CONTENT: "BYTE_CONTENT",
|
|
573
610
|
S3: "S3",
|
|
@@ -583,6 +620,36 @@ export const GuadrailAction = {
|
|
|
583
620
|
INTERVENED: "INTERVENED",
|
|
584
621
|
NONE: "NONE",
|
|
585
622
|
};
|
|
623
|
+
export var RetrieveAndGenerateStreamResponseOutput;
|
|
624
|
+
(function (RetrieveAndGenerateStreamResponseOutput) {
|
|
625
|
+
RetrieveAndGenerateStreamResponseOutput.visit = (value, visitor) => {
|
|
626
|
+
if (value.output !== undefined)
|
|
627
|
+
return visitor.output(value.output);
|
|
628
|
+
if (value.citation !== undefined)
|
|
629
|
+
return visitor.citation(value.citation);
|
|
630
|
+
if (value.guardrail !== undefined)
|
|
631
|
+
return visitor.guardrail(value.guardrail);
|
|
632
|
+
if (value.internalServerException !== undefined)
|
|
633
|
+
return visitor.internalServerException(value.internalServerException);
|
|
634
|
+
if (value.validationException !== undefined)
|
|
635
|
+
return visitor.validationException(value.validationException);
|
|
636
|
+
if (value.resourceNotFoundException !== undefined)
|
|
637
|
+
return visitor.resourceNotFoundException(value.resourceNotFoundException);
|
|
638
|
+
if (value.serviceQuotaExceededException !== undefined)
|
|
639
|
+
return visitor.serviceQuotaExceededException(value.serviceQuotaExceededException);
|
|
640
|
+
if (value.throttlingException !== undefined)
|
|
641
|
+
return visitor.throttlingException(value.throttlingException);
|
|
642
|
+
if (value.accessDeniedException !== undefined)
|
|
643
|
+
return visitor.accessDeniedException(value.accessDeniedException);
|
|
644
|
+
if (value.conflictException !== undefined)
|
|
645
|
+
return visitor.conflictException(value.conflictException);
|
|
646
|
+
if (value.dependencyFailedException !== undefined)
|
|
647
|
+
return visitor.dependencyFailedException(value.dependencyFailedException);
|
|
648
|
+
if (value.badGatewayException !== undefined)
|
|
649
|
+
return visitor.badGatewayException(value.badGatewayException);
|
|
650
|
+
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
651
|
+
};
|
|
652
|
+
})(RetrieveAndGenerateStreamResponseOutput || (RetrieveAndGenerateStreamResponseOutput = {}));
|
|
586
653
|
export var RetrievalFilter;
|
|
587
654
|
(function (RetrievalFilter) {
|
|
588
655
|
RetrievalFilter.visit = (value, visitor) => {
|
|
@@ -760,6 +827,39 @@ export const InputFileFilterSensitiveLog = (obj) => ({
|
|
|
760
827
|
...obj,
|
|
761
828
|
...(obj.source && { source: FileSourceFilterSensitiveLog(obj.source) }),
|
|
762
829
|
});
|
|
830
|
+
export const MetadataAttributeSchemaFilterSensitiveLog = (obj) => ({
|
|
831
|
+
...obj,
|
|
832
|
+
});
|
|
833
|
+
export const ImplicitFilterConfigurationFilterSensitiveLog = (obj) => ({
|
|
834
|
+
...obj,
|
|
835
|
+
...(obj.metadataAttributes && { metadataAttributes: SENSITIVE_STRING }),
|
|
836
|
+
});
|
|
837
|
+
export const RerankingMetadataSelectiveModeConfigurationFilterSensitiveLog = (obj) => {
|
|
838
|
+
if (obj.fieldsToInclude !== undefined)
|
|
839
|
+
return { fieldsToInclude: SENSITIVE_STRING };
|
|
840
|
+
if (obj.fieldsToExclude !== undefined)
|
|
841
|
+
return { fieldsToExclude: SENSITIVE_STRING };
|
|
842
|
+
if (obj.$unknown !== undefined)
|
|
843
|
+
return { [obj.$unknown[0]]: "UNKNOWN" };
|
|
844
|
+
};
|
|
845
|
+
export const MetadataConfigurationForRerankingFilterSensitiveLog = (obj) => ({
|
|
846
|
+
...obj,
|
|
847
|
+
...(obj.selectiveModeConfiguration && {
|
|
848
|
+
selectiveModeConfiguration: RerankingMetadataSelectiveModeConfigurationFilterSensitiveLog(obj.selectiveModeConfiguration),
|
|
849
|
+
}),
|
|
850
|
+
});
|
|
851
|
+
export const VectorSearchBedrockRerankingConfigurationFilterSensitiveLog = (obj) => ({
|
|
852
|
+
...obj,
|
|
853
|
+
...(obj.metadataConfiguration && {
|
|
854
|
+
metadataConfiguration: MetadataConfigurationForRerankingFilterSensitiveLog(obj.metadataConfiguration),
|
|
855
|
+
}),
|
|
856
|
+
});
|
|
857
|
+
export const VectorSearchRerankingConfigurationFilterSensitiveLog = (obj) => ({
|
|
858
|
+
...obj,
|
|
859
|
+
...(obj.bedrockRerankingConfiguration && {
|
|
860
|
+
bedrockRerankingConfiguration: VectorSearchBedrockRerankingConfigurationFilterSensitiveLog(obj.bedrockRerankingConfiguration),
|
|
861
|
+
}),
|
|
862
|
+
});
|
|
763
863
|
export const ApiResultFilterSensitiveLog = (obj) => ({
|
|
764
864
|
...obj,
|
|
765
865
|
...(obj.apiPath && { apiPath: SENSITIVE_STRING }),
|
|
@@ -1180,6 +1280,34 @@ export const OptimizePromptResponseFilterSensitiveLog = (obj) => ({
|
|
|
1180
1280
|
...obj,
|
|
1181
1281
|
...(obj.optimizedPrompt && { optimizedPrompt: "STREAMING_CONTENT" }),
|
|
1182
1282
|
});
|
|
1283
|
+
export const RerankTextDocumentFilterSensitiveLog = (obj) => ({
|
|
1284
|
+
...obj,
|
|
1285
|
+
});
|
|
1286
|
+
export const RerankQueryFilterSensitiveLog = (obj) => ({
|
|
1287
|
+
...obj,
|
|
1288
|
+
...(obj.textQuery && { textQuery: SENSITIVE_STRING }),
|
|
1289
|
+
});
|
|
1290
|
+
export const RerankDocumentFilterSensitiveLog = (obj) => ({
|
|
1291
|
+
...obj,
|
|
1292
|
+
...(obj.textDocument && { textDocument: SENSITIVE_STRING }),
|
|
1293
|
+
});
|
|
1294
|
+
export const RerankSourceFilterSensitiveLog = (obj) => ({
|
|
1295
|
+
...obj,
|
|
1296
|
+
...(obj.inlineDocumentSource && { inlineDocumentSource: SENSITIVE_STRING }),
|
|
1297
|
+
});
|
|
1298
|
+
export const RerankRequestFilterSensitiveLog = (obj) => ({
|
|
1299
|
+
...obj,
|
|
1300
|
+
...(obj.queries && { queries: SENSITIVE_STRING }),
|
|
1301
|
+
...(obj.sources && { sources: SENSITIVE_STRING }),
|
|
1302
|
+
});
|
|
1303
|
+
export const RerankResultFilterSensitiveLog = (obj) => ({
|
|
1304
|
+
...obj,
|
|
1305
|
+
...(obj.document && { document: SENSITIVE_STRING }),
|
|
1306
|
+
});
|
|
1307
|
+
export const RerankResponseFilterSensitiveLog = (obj) => ({
|
|
1308
|
+
...obj,
|
|
1309
|
+
...(obj.results && { results: obj.results.map((item) => RerankResultFilterSensitiveLog(item)) }),
|
|
1310
|
+
});
|
|
1183
1311
|
export const RetrieveAndGenerateInputFilterSensitiveLog = (obj) => ({
|
|
1184
1312
|
...obj,
|
|
1185
1313
|
});
|
|
@@ -1223,6 +1351,45 @@ export const RetrieveAndGenerateResponseFilterSensitiveLog = (obj) => ({
|
|
|
1223
1351
|
...(obj.output && { output: SENSITIVE_STRING }),
|
|
1224
1352
|
...(obj.citations && { citations: obj.citations.map((item) => CitationFilterSensitiveLog(item)) }),
|
|
1225
1353
|
});
|
|
1354
|
+
export const CitationEventFilterSensitiveLog = (obj) => ({
|
|
1355
|
+
...obj,
|
|
1356
|
+
...(obj.citation && { citation: CitationFilterSensitiveLog(obj.citation) }),
|
|
1357
|
+
});
|
|
1358
|
+
export const RetrieveAndGenerateOutputEventFilterSensitiveLog = (obj) => ({
|
|
1359
|
+
...obj,
|
|
1360
|
+
});
|
|
1361
|
+
export const RetrieveAndGenerateStreamResponseOutputFilterSensitiveLog = (obj) => {
|
|
1362
|
+
if (obj.output !== undefined)
|
|
1363
|
+
return { output: SENSITIVE_STRING };
|
|
1364
|
+
if (obj.citation !== undefined)
|
|
1365
|
+
return { citation: CitationEventFilterSensitiveLog(obj.citation) };
|
|
1366
|
+
if (obj.guardrail !== undefined)
|
|
1367
|
+
return { guardrail: obj.guardrail };
|
|
1368
|
+
if (obj.internalServerException !== undefined)
|
|
1369
|
+
return { internalServerException: obj.internalServerException };
|
|
1370
|
+
if (obj.validationException !== undefined)
|
|
1371
|
+
return { validationException: obj.validationException };
|
|
1372
|
+
if (obj.resourceNotFoundException !== undefined)
|
|
1373
|
+
return { resourceNotFoundException: obj.resourceNotFoundException };
|
|
1374
|
+
if (obj.serviceQuotaExceededException !== undefined)
|
|
1375
|
+
return { serviceQuotaExceededException: obj.serviceQuotaExceededException };
|
|
1376
|
+
if (obj.throttlingException !== undefined)
|
|
1377
|
+
return { throttlingException: obj.throttlingException };
|
|
1378
|
+
if (obj.accessDeniedException !== undefined)
|
|
1379
|
+
return { accessDeniedException: obj.accessDeniedException };
|
|
1380
|
+
if (obj.conflictException !== undefined)
|
|
1381
|
+
return { conflictException: obj.conflictException };
|
|
1382
|
+
if (obj.dependencyFailedException !== undefined)
|
|
1383
|
+
return { dependencyFailedException: obj.dependencyFailedException };
|
|
1384
|
+
if (obj.badGatewayException !== undefined)
|
|
1385
|
+
return { badGatewayException: obj.badGatewayException };
|
|
1386
|
+
if (obj.$unknown !== undefined)
|
|
1387
|
+
return { [obj.$unknown[0]]: "UNKNOWN" };
|
|
1388
|
+
};
|
|
1389
|
+
export const RetrieveAndGenerateStreamResponseFilterSensitiveLog = (obj) => ({
|
|
1390
|
+
...obj,
|
|
1391
|
+
...(obj.stream && { stream: "STREAMING_CONTENT" }),
|
|
1392
|
+
});
|
|
1226
1393
|
export const KnowledgeBaseQueryFilterSensitiveLog = (obj) => ({
|
|
1227
1394
|
...obj,
|
|
1228
1395
|
});
|
|
@@ -1269,6 +1436,12 @@ export const RetrievalFilterFilterSensitiveLog = (obj) => {
|
|
|
1269
1436
|
export const KnowledgeBaseVectorSearchConfigurationFilterSensitiveLog = (obj) => ({
|
|
1270
1437
|
...obj,
|
|
1271
1438
|
...(obj.filter && { filter: SENSITIVE_STRING }),
|
|
1439
|
+
...(obj.rerankingConfiguration && {
|
|
1440
|
+
rerankingConfiguration: VectorSearchRerankingConfigurationFilterSensitiveLog(obj.rerankingConfiguration),
|
|
1441
|
+
}),
|
|
1442
|
+
...(obj.implicitFilterConfiguration && {
|
|
1443
|
+
implicitFilterConfiguration: ImplicitFilterConfigurationFilterSensitiveLog(obj.implicitFilterConfiguration),
|
|
1444
|
+
}),
|
|
1272
1445
|
});
|
|
1273
1446
|
export const KnowledgeBaseRetrievalConfigurationFilterSensitiveLog = (obj) => ({
|
|
1274
1447
|
...obj,
|
|
@@ -1335,6 +1508,13 @@ export const RetrieveAndGenerateRequestFilterSensitiveLog = (obj) => ({
|
|
|
1335
1508
|
retrieveAndGenerateConfiguration: RetrieveAndGenerateConfigurationFilterSensitiveLog(obj.retrieveAndGenerateConfiguration),
|
|
1336
1509
|
}),
|
|
1337
1510
|
});
|
|
1511
|
+
export const RetrieveAndGenerateStreamRequestFilterSensitiveLog = (obj) => ({
|
|
1512
|
+
...obj,
|
|
1513
|
+
...(obj.input && { input: SENSITIVE_STRING }),
|
|
1514
|
+
...(obj.retrieveAndGenerateConfiguration && {
|
|
1515
|
+
retrieveAndGenerateConfiguration: RetrieveAndGenerateConfigurationFilterSensitiveLog(obj.retrieveAndGenerateConfiguration),
|
|
1516
|
+
}),
|
|
1517
|
+
});
|
|
1338
1518
|
export const SessionStateFilterSensitiveLog = (obj) => ({
|
|
1339
1519
|
...obj,
|
|
1340
1520
|
...(obj.returnControlInvocationResults && {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createPaginator } from "@smithy/core";
|
|
2
|
+
import { BedrockAgentRuntimeClient } from "../BedrockAgentRuntimeClient";
|
|
3
|
+
import { RerankCommand } from "../commands/RerankCommand";
|
|
4
|
+
export const paginateRerank = createPaginator(BedrockAgentRuntimeClient, RerankCommand, "nextToken", "nextToken", "");
|
|
@@ -108,6 +108,22 @@ export const se_OptimizePromptCommand = async (input, context) => {
|
|
|
108
108
|
b.m("POST").h(headers).b(body);
|
|
109
109
|
return b.build();
|
|
110
110
|
};
|
|
111
|
+
export const se_RerankCommand = async (input, context) => {
|
|
112
|
+
const b = rb(input, context);
|
|
113
|
+
const headers = {
|
|
114
|
+
"content-type": "application/json",
|
|
115
|
+
};
|
|
116
|
+
b.bp("/rerank");
|
|
117
|
+
let body;
|
|
118
|
+
body = JSON.stringify(take(input, {
|
|
119
|
+
nextToken: [],
|
|
120
|
+
queries: (_) => _json(_),
|
|
121
|
+
rerankingConfiguration: (_) => se_RerankingConfiguration(_, context),
|
|
122
|
+
sources: (_) => se_RerankSourcesList(_, context),
|
|
123
|
+
}));
|
|
124
|
+
b.m("POST").h(headers).b(body);
|
|
125
|
+
return b.build();
|
|
126
|
+
};
|
|
111
127
|
export const se_RetrieveCommand = async (input, context) => {
|
|
112
128
|
const b = rb(input, context);
|
|
113
129
|
const headers = {
|
|
@@ -117,6 +133,7 @@ export const se_RetrieveCommand = async (input, context) => {
|
|
|
117
133
|
b.p("knowledgeBaseId", () => input.knowledgeBaseId, "{knowledgeBaseId}", false);
|
|
118
134
|
let body;
|
|
119
135
|
body = JSON.stringify(take(input, {
|
|
136
|
+
guardrailConfiguration: (_) => _json(_),
|
|
120
137
|
nextToken: [],
|
|
121
138
|
retrievalConfiguration: (_) => se_KnowledgeBaseRetrievalConfiguration(_, context),
|
|
122
139
|
retrievalQuery: (_) => _json(_),
|
|
@@ -140,6 +157,22 @@ export const se_RetrieveAndGenerateCommand = async (input, context) => {
|
|
|
140
157
|
b.m("POST").h(headers).b(body);
|
|
141
158
|
return b.build();
|
|
142
159
|
};
|
|
160
|
+
export const se_RetrieveAndGenerateStreamCommand = async (input, context) => {
|
|
161
|
+
const b = rb(input, context);
|
|
162
|
+
const headers = {
|
|
163
|
+
"content-type": "application/json",
|
|
164
|
+
};
|
|
165
|
+
b.bp("/retrieveAndGenerateStream");
|
|
166
|
+
let body;
|
|
167
|
+
body = JSON.stringify(take(input, {
|
|
168
|
+
input: (_) => _json(_),
|
|
169
|
+
retrieveAndGenerateConfiguration: (_) => se_RetrieveAndGenerateConfiguration(_, context),
|
|
170
|
+
sessionConfiguration: (_) => _json(_),
|
|
171
|
+
sessionId: [],
|
|
172
|
+
}));
|
|
173
|
+
b.m("POST").h(headers).b(body);
|
|
174
|
+
return b.build();
|
|
175
|
+
};
|
|
143
176
|
export const de_DeleteAgentMemoryCommand = async (output, context) => {
|
|
144
177
|
if (output.statusCode !== 202 && output.statusCode >= 300) {
|
|
145
178
|
return de_CommandError(output, context);
|
|
@@ -214,6 +247,21 @@ export const de_OptimizePromptCommand = async (output, context) => {
|
|
|
214
247
|
contents.optimizedPrompt = de_OptimizedPromptStream(data, context);
|
|
215
248
|
return contents;
|
|
216
249
|
};
|
|
250
|
+
export const de_RerankCommand = async (output, context) => {
|
|
251
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
252
|
+
return de_CommandError(output, context);
|
|
253
|
+
}
|
|
254
|
+
const contents = map({
|
|
255
|
+
$metadata: deserializeMetadata(output),
|
|
256
|
+
});
|
|
257
|
+
const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
|
258
|
+
const doc = take(data, {
|
|
259
|
+
nextToken: __expectString,
|
|
260
|
+
results: (_) => de_RerankResultsList(_, context),
|
|
261
|
+
});
|
|
262
|
+
Object.assign(contents, doc);
|
|
263
|
+
return contents;
|
|
264
|
+
};
|
|
217
265
|
export const de_RetrieveCommand = async (output, context) => {
|
|
218
266
|
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
219
267
|
return de_CommandError(output, context);
|
|
@@ -223,6 +271,7 @@ export const de_RetrieveCommand = async (output, context) => {
|
|
|
223
271
|
});
|
|
224
272
|
const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
|
225
273
|
const doc = take(data, {
|
|
274
|
+
guardrailAction: __expectString,
|
|
226
275
|
nextToken: __expectString,
|
|
227
276
|
retrievalResults: (_) => de_KnowledgeBaseRetrievalResults(_, context),
|
|
228
277
|
});
|
|
@@ -246,6 +295,18 @@ export const de_RetrieveAndGenerateCommand = async (output, context) => {
|
|
|
246
295
|
Object.assign(contents, doc);
|
|
247
296
|
return contents;
|
|
248
297
|
};
|
|
298
|
+
export const de_RetrieveAndGenerateStreamCommand = async (output, context) => {
|
|
299
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
300
|
+
return de_CommandError(output, context);
|
|
301
|
+
}
|
|
302
|
+
const contents = map({
|
|
303
|
+
$metadata: deserializeMetadata(output),
|
|
304
|
+
[_sI]: [, output.headers[_xabkbsi]],
|
|
305
|
+
});
|
|
306
|
+
const data = output.body;
|
|
307
|
+
contents.stream = de_RetrieveAndGenerateStreamResponseOutput(data, context);
|
|
308
|
+
return contents;
|
|
309
|
+
};
|
|
249
310
|
const de_CommandError = async (output, context) => {
|
|
250
311
|
const parsedOutput = {
|
|
251
312
|
...output,
|
|
@@ -659,6 +720,71 @@ const de_ResponseStream = (output, context) => {
|
|
|
659
720
|
return { $unknown: output };
|
|
660
721
|
});
|
|
661
722
|
};
|
|
723
|
+
const de_RetrieveAndGenerateStreamResponseOutput = (output, context) => {
|
|
724
|
+
return context.eventStreamMarshaller.deserialize(output, async (event) => {
|
|
725
|
+
if (event["output"] != null) {
|
|
726
|
+
return {
|
|
727
|
+
output: await de_RetrieveAndGenerateOutputEvent_event(event["output"], context),
|
|
728
|
+
};
|
|
729
|
+
}
|
|
730
|
+
if (event["citation"] != null) {
|
|
731
|
+
return {
|
|
732
|
+
citation: await de_CitationEvent_event(event["citation"], context),
|
|
733
|
+
};
|
|
734
|
+
}
|
|
735
|
+
if (event["guardrail"] != null) {
|
|
736
|
+
return {
|
|
737
|
+
guardrail: await de_GuardrailEvent_event(event["guardrail"], context),
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
if (event["internalServerException"] != null) {
|
|
741
|
+
return {
|
|
742
|
+
internalServerException: await de_InternalServerException_event(event["internalServerException"], context),
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
if (event["validationException"] != null) {
|
|
746
|
+
return {
|
|
747
|
+
validationException: await de_ValidationException_event(event["validationException"], context),
|
|
748
|
+
};
|
|
749
|
+
}
|
|
750
|
+
if (event["resourceNotFoundException"] != null) {
|
|
751
|
+
return {
|
|
752
|
+
resourceNotFoundException: await de_ResourceNotFoundException_event(event["resourceNotFoundException"], context),
|
|
753
|
+
};
|
|
754
|
+
}
|
|
755
|
+
if (event["serviceQuotaExceededException"] != null) {
|
|
756
|
+
return {
|
|
757
|
+
serviceQuotaExceededException: await de_ServiceQuotaExceededException_event(event["serviceQuotaExceededException"], context),
|
|
758
|
+
};
|
|
759
|
+
}
|
|
760
|
+
if (event["throttlingException"] != null) {
|
|
761
|
+
return {
|
|
762
|
+
throttlingException: await de_ThrottlingException_event(event["throttlingException"], context),
|
|
763
|
+
};
|
|
764
|
+
}
|
|
765
|
+
if (event["accessDeniedException"] != null) {
|
|
766
|
+
return {
|
|
767
|
+
accessDeniedException: await de_AccessDeniedException_event(event["accessDeniedException"], context),
|
|
768
|
+
};
|
|
769
|
+
}
|
|
770
|
+
if (event["conflictException"] != null) {
|
|
771
|
+
return {
|
|
772
|
+
conflictException: await de_ConflictException_event(event["conflictException"], context),
|
|
773
|
+
};
|
|
774
|
+
}
|
|
775
|
+
if (event["dependencyFailedException"] != null) {
|
|
776
|
+
return {
|
|
777
|
+
dependencyFailedException: await de_DependencyFailedException_event(event["dependencyFailedException"], context),
|
|
778
|
+
};
|
|
779
|
+
}
|
|
780
|
+
if (event["badGatewayException"] != null) {
|
|
781
|
+
return {
|
|
782
|
+
badGatewayException: await de_BadGatewayException_event(event["badGatewayException"], context),
|
|
783
|
+
};
|
|
784
|
+
}
|
|
785
|
+
return { $unknown: output };
|
|
786
|
+
});
|
|
787
|
+
};
|
|
662
788
|
const de_AccessDeniedException_event = async (output, context) => {
|
|
663
789
|
const parsedOutput = {
|
|
664
790
|
...output,
|
|
@@ -679,6 +805,12 @@ const de_BadGatewayException_event = async (output, context) => {
|
|
|
679
805
|
};
|
|
680
806
|
return de_BadGatewayExceptionRes(parsedOutput, context);
|
|
681
807
|
};
|
|
808
|
+
const de_CitationEvent_event = async (output, context) => {
|
|
809
|
+
const contents = {};
|
|
810
|
+
const data = await parseBody(output.body, context);
|
|
811
|
+
Object.assign(contents, de_CitationEvent(data, context));
|
|
812
|
+
return contents;
|
|
813
|
+
};
|
|
682
814
|
const de_ConflictException_event = async (output, context) => {
|
|
683
815
|
const parsedOutput = {
|
|
684
816
|
...output,
|
|
@@ -717,6 +849,12 @@ const de_FlowTraceEvent_event = async (output, context) => {
|
|
|
717
849
|
Object.assign(contents, de_FlowTraceEvent(data, context));
|
|
718
850
|
return contents;
|
|
719
851
|
};
|
|
852
|
+
const de_GuardrailEvent_event = async (output, context) => {
|
|
853
|
+
const contents = {};
|
|
854
|
+
const data = await parseBody(output.body, context);
|
|
855
|
+
Object.assign(contents, _json(data));
|
|
856
|
+
return contents;
|
|
857
|
+
};
|
|
720
858
|
const de_InlineAgentFilePart_event = async (output, context) => {
|
|
721
859
|
const contents = {};
|
|
722
860
|
const data = await parseBody(output.body, context);
|
|
@@ -767,6 +905,12 @@ const de_ResourceNotFoundException_event = async (output, context) => {
|
|
|
767
905
|
};
|
|
768
906
|
return de_ResourceNotFoundExceptionRes(parsedOutput, context);
|
|
769
907
|
};
|
|
908
|
+
const de_RetrieveAndGenerateOutputEvent_event = async (output, context) => {
|
|
909
|
+
const contents = {};
|
|
910
|
+
const data = await parseBody(output.body, context);
|
|
911
|
+
Object.assign(contents, _json(data));
|
|
912
|
+
return contents;
|
|
913
|
+
};
|
|
770
914
|
const de_ReturnControlPayload_event = async (output, context) => {
|
|
771
915
|
const contents = {};
|
|
772
916
|
const data = await parseBody(output.body, context);
|
|
@@ -812,6 +956,18 @@ const se_AdditionalModelRequestFields = (input, context) => {
|
|
|
812
956
|
const se_AdditionalModelRequestFieldsValue = (input, context) => {
|
|
813
957
|
return input;
|
|
814
958
|
};
|
|
959
|
+
const se_BedrockRerankingConfiguration = (input, context) => {
|
|
960
|
+
return take(input, {
|
|
961
|
+
modelConfiguration: (_) => se_BedrockRerankingModelConfiguration(_, context),
|
|
962
|
+
numberOfResults: [],
|
|
963
|
+
});
|
|
964
|
+
};
|
|
965
|
+
const se_BedrockRerankingModelConfiguration = (input, context) => {
|
|
966
|
+
return take(input, {
|
|
967
|
+
additionalModelRequestFields: (_) => se_AdditionalModelRequestFields(_, context),
|
|
968
|
+
modelArn: [],
|
|
969
|
+
});
|
|
970
|
+
};
|
|
815
971
|
const se_ByteContentDoc = (input, context) => {
|
|
816
972
|
return take(input, {
|
|
817
973
|
contentType: [],
|
|
@@ -979,8 +1135,10 @@ const se_KnowledgeBases = (input, context) => {
|
|
|
979
1135
|
const se_KnowledgeBaseVectorSearchConfiguration = (input, context) => {
|
|
980
1136
|
return take(input, {
|
|
981
1137
|
filter: (_) => se_RetrievalFilter(_, context),
|
|
1138
|
+
implicitFilterConfiguration: _json,
|
|
982
1139
|
numberOfResults: [],
|
|
983
1140
|
overrideSearchType: [],
|
|
1141
|
+
rerankingConfiguration: (_) => se_VectorSearchRerankingConfiguration(_, context),
|
|
984
1142
|
});
|
|
985
1143
|
};
|
|
986
1144
|
const se_OrchestrationConfiguration = (input, context) => {
|
|
@@ -1014,6 +1172,32 @@ const se_PromptOverrideConfiguration = (input, context) => {
|
|
|
1014
1172
|
promptConfigurations: (_) => se_PromptConfigurations(_, context),
|
|
1015
1173
|
});
|
|
1016
1174
|
};
|
|
1175
|
+
const se_RerankDocument = (input, context) => {
|
|
1176
|
+
return take(input, {
|
|
1177
|
+
jsonDocument: (_) => se_Document(_, context),
|
|
1178
|
+
textDocument: _json,
|
|
1179
|
+
type: [],
|
|
1180
|
+
});
|
|
1181
|
+
};
|
|
1182
|
+
const se_RerankingConfiguration = (input, context) => {
|
|
1183
|
+
return take(input, {
|
|
1184
|
+
bedrockRerankingConfiguration: (_) => se_BedrockRerankingConfiguration(_, context),
|
|
1185
|
+
type: [],
|
|
1186
|
+
});
|
|
1187
|
+
};
|
|
1188
|
+
const se_RerankSource = (input, context) => {
|
|
1189
|
+
return take(input, {
|
|
1190
|
+
inlineDocumentSource: (_) => se_RerankDocument(_, context),
|
|
1191
|
+
type: [],
|
|
1192
|
+
});
|
|
1193
|
+
};
|
|
1194
|
+
const se_RerankSourcesList = (input, context) => {
|
|
1195
|
+
return input
|
|
1196
|
+
.filter((e) => e != null)
|
|
1197
|
+
.map((entry) => {
|
|
1198
|
+
return se_RerankSource(entry, context);
|
|
1199
|
+
});
|
|
1200
|
+
};
|
|
1017
1201
|
const se_RetrievalFilter = (input, context) => {
|
|
1018
1202
|
return RetrievalFilter.visit(input, {
|
|
1019
1203
|
andAll: (value) => ({ andAll: se_RetrievalFilterList(value, context) }),
|
|
@@ -1064,6 +1248,25 @@ const se_TextInferenceConfig = (input, context) => {
|
|
|
1064
1248
|
topP: __serializeFloat,
|
|
1065
1249
|
});
|
|
1066
1250
|
};
|
|
1251
|
+
const se_VectorSearchBedrockRerankingConfiguration = (input, context) => {
|
|
1252
|
+
return take(input, {
|
|
1253
|
+
metadataConfiguration: _json,
|
|
1254
|
+
modelConfiguration: (_) => se_VectorSearchBedrockRerankingModelConfiguration(_, context),
|
|
1255
|
+
numberOfRerankedResults: [],
|
|
1256
|
+
});
|
|
1257
|
+
};
|
|
1258
|
+
const se_VectorSearchBedrockRerankingModelConfiguration = (input, context) => {
|
|
1259
|
+
return take(input, {
|
|
1260
|
+
additionalModelRequestFields: (_) => se_AdditionalModelRequestFields(_, context),
|
|
1261
|
+
modelArn: [],
|
|
1262
|
+
});
|
|
1263
|
+
};
|
|
1264
|
+
const se_VectorSearchRerankingConfiguration = (input, context) => {
|
|
1265
|
+
return take(input, {
|
|
1266
|
+
bedrockRerankingConfiguration: (_) => se_VectorSearchBedrockRerankingConfiguration(_, context),
|
|
1267
|
+
type: [],
|
|
1268
|
+
});
|
|
1269
|
+
};
|
|
1067
1270
|
const se_Document = (input, context) => {
|
|
1068
1271
|
return input;
|
|
1069
1272
|
};
|
|
@@ -1078,6 +1281,11 @@ const de_Citation = (output, context) => {
|
|
|
1078
1281
|
retrievedReferences: (_) => de_RetrievedReferences(_, context),
|
|
1079
1282
|
});
|
|
1080
1283
|
};
|
|
1284
|
+
const de_CitationEvent = (output, context) => {
|
|
1285
|
+
return take(output, {
|
|
1286
|
+
citation: (_) => de_Citation(_, context),
|
|
1287
|
+
});
|
|
1288
|
+
};
|
|
1081
1289
|
const de_Citations = (output, context) => {
|
|
1082
1290
|
const retVal = (output || [])
|
|
1083
1291
|
.filter((e) => e != null)
|
|
@@ -1363,6 +1571,28 @@ const de_PreProcessingTrace = (output, context) => {
|
|
|
1363
1571
|
}
|
|
1364
1572
|
return { $unknown: Object.entries(output)[0] };
|
|
1365
1573
|
};
|
|
1574
|
+
const de_RerankDocument = (output, context) => {
|
|
1575
|
+
return take(output, {
|
|
1576
|
+
jsonDocument: (_) => de_Document(_, context),
|
|
1577
|
+
textDocument: _json,
|
|
1578
|
+
type: __expectString,
|
|
1579
|
+
});
|
|
1580
|
+
};
|
|
1581
|
+
const de_RerankResult = (output, context) => {
|
|
1582
|
+
return take(output, {
|
|
1583
|
+
document: (_) => de_RerankDocument(_, context),
|
|
1584
|
+
index: __expectInt32,
|
|
1585
|
+
relevanceScore: __limitedParseFloat32,
|
|
1586
|
+
});
|
|
1587
|
+
};
|
|
1588
|
+
const de_RerankResultsList = (output, context) => {
|
|
1589
|
+
const retVal = (output || [])
|
|
1590
|
+
.filter((e) => e != null)
|
|
1591
|
+
.map((entry) => {
|
|
1592
|
+
return de_RerankResult(entry, context);
|
|
1593
|
+
});
|
|
1594
|
+
return retVal;
|
|
1595
|
+
};
|
|
1366
1596
|
const de_RetrievalResultMetadata = (output, context) => {
|
|
1367
1597
|
return Object.entries(output).reduce((acc, [key, value]) => {
|
|
1368
1598
|
if (value === null) {
|
|
@@ -1451,3 +1681,4 @@ const _sI = "sessionId";
|
|
|
1451
1681
|
const _xabact = "x-amzn-bedrock-agent-content-type";
|
|
1452
1682
|
const _xabami = "x-amz-bedrock-agent-memory-id";
|
|
1453
1683
|
const _xabasi = "x-amz-bedrock-agent-session-id";
|
|
1684
|
+
const _xabkbsi = "x-amzn-bedrock-knowledge-base-session-id";
|