Skip to content

Commit 4ed232e

Browse files
author
awstools
committed
feat(client-bedrock-agent-runtime): This release introduces a new Rerank API to leverage reranking models (with integration into Knowledge Bases); APIs to upload documents directly into Knowledge Base; RetrieveAndGenerateStream API for streaming response; Guardrails on Retrieve API; and ability to automatically generate filters
1 parent ac2bf51 commit 4ed232e

15 files changed

+3398
-87
lines changed

Diff for: clients/client-bedrock-agent-runtime/README.md

+16
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,14 @@ OptimizePrompt
250250

251251
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock-agent-runtime/command/OptimizePromptCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-agent-runtime/Interface/OptimizePromptCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-agent-runtime/Interface/OptimizePromptCommandOutput/)
252252

253+
</details>
254+
<details>
255+
<summary>
256+
Rerank
257+
</summary>
258+
259+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock-agent-runtime/command/RerankCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-agent-runtime/Interface/RerankCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-agent-runtime/Interface/RerankCommandOutput/)
260+
253261
</details>
254262
<details>
255263
<summary>
@@ -267,3 +275,11 @@ RetrieveAndGenerate
267275
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock-agent-runtime/command/RetrieveAndGenerateCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-agent-runtime/Interface/RetrieveAndGenerateCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-agent-runtime/Interface/RetrieveAndGenerateCommandOutput/)
268276

269277
</details>
278+
<details>
279+
<summary>
280+
RetrieveAndGenerateStream
281+
</summary>
282+
283+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock-agent-runtime/command/RetrieveAndGenerateStreamCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-agent-runtime/Interface/RetrieveAndGenerateStreamCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-agent-runtime/Interface/RetrieveAndGenerateStreamCommandOutput/)
284+
285+
</details>

Diff for: clients/client-bedrock-agent-runtime/src/BedrockAgentRuntime.ts

+36
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,17 @@ import {
2525
OptimizePromptCommandInput,
2626
OptimizePromptCommandOutput,
2727
} from "./commands/OptimizePromptCommand";
28+
import { RerankCommand, RerankCommandInput, RerankCommandOutput } from "./commands/RerankCommand";
2829
import {
2930
RetrieveAndGenerateCommand,
3031
RetrieveAndGenerateCommandInput,
3132
RetrieveAndGenerateCommandOutput,
3233
} from "./commands/RetrieveAndGenerateCommand";
34+
import {
35+
RetrieveAndGenerateStreamCommand,
36+
RetrieveAndGenerateStreamCommandInput,
37+
RetrieveAndGenerateStreamCommandOutput,
38+
} from "./commands/RetrieveAndGenerateStreamCommand";
3339
import { RetrieveCommand, RetrieveCommandInput, RetrieveCommandOutput } from "./commands/RetrieveCommand";
3440

3541
const commands = {
@@ -39,8 +45,10 @@ const commands = {
3945
InvokeFlowCommand,
4046
InvokeInlineAgentCommand,
4147
OptimizePromptCommand,
48+
RerankCommand,
4249
RetrieveCommand,
4350
RetrieveAndGenerateCommand,
51+
RetrieveAndGenerateStreamCommand,
4452
};
4553

4654
export interface BedrockAgentRuntime {
@@ -128,6 +136,17 @@ export interface BedrockAgentRuntime {
128136
cb: (err: any, data?: OptimizePromptCommandOutput) => void
129137
): void;
130138

139+
/**
140+
* @see {@link RerankCommand}
141+
*/
142+
rerank(args: RerankCommandInput, options?: __HttpHandlerOptions): Promise<RerankCommandOutput>;
143+
rerank(args: RerankCommandInput, cb: (err: any, data?: RerankCommandOutput) => void): void;
144+
rerank(
145+
args: RerankCommandInput,
146+
options: __HttpHandlerOptions,
147+
cb: (err: any, data?: RerankCommandOutput) => void
148+
): void;
149+
131150
/**
132151
* @see {@link RetrieveCommand}
133152
*/
@@ -155,6 +174,23 @@ export interface BedrockAgentRuntime {
155174
options: __HttpHandlerOptions,
156175
cb: (err: any, data?: RetrieveAndGenerateCommandOutput) => void
157176
): void;
177+
178+
/**
179+
* @see {@link RetrieveAndGenerateStreamCommand}
180+
*/
181+
retrieveAndGenerateStream(
182+
args: RetrieveAndGenerateStreamCommandInput,
183+
options?: __HttpHandlerOptions
184+
): Promise<RetrieveAndGenerateStreamCommandOutput>;
185+
retrieveAndGenerateStream(
186+
args: RetrieveAndGenerateStreamCommandInput,
187+
cb: (err: any, data?: RetrieveAndGenerateStreamCommandOutput) => void
188+
): void;
189+
retrieveAndGenerateStream(
190+
args: RetrieveAndGenerateStreamCommandInput,
191+
options: __HttpHandlerOptions,
192+
cb: (err: any, data?: RetrieveAndGenerateStreamCommandOutput) => void
193+
): void;
158194
}
159195

160196
/**

Diff for: clients/client-bedrock-agent-runtime/src/BedrockAgentRuntimeClient.ts

+9
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,15 @@ import { InvokeAgentCommandInput, InvokeAgentCommandOutput } from "./commands/In
6565
import { InvokeFlowCommandInput, InvokeFlowCommandOutput } from "./commands/InvokeFlowCommand";
6666
import { InvokeInlineAgentCommandInput, InvokeInlineAgentCommandOutput } from "./commands/InvokeInlineAgentCommand";
6767
import { OptimizePromptCommandInput, OptimizePromptCommandOutput } from "./commands/OptimizePromptCommand";
68+
import { RerankCommandInput, RerankCommandOutput } from "./commands/RerankCommand";
6869
import {
6970
RetrieveAndGenerateCommandInput,
7071
RetrieveAndGenerateCommandOutput,
7172
} from "./commands/RetrieveAndGenerateCommand";
73+
import {
74+
RetrieveAndGenerateStreamCommandInput,
75+
RetrieveAndGenerateStreamCommandOutput,
76+
} from "./commands/RetrieveAndGenerateStreamCommand";
7277
import { RetrieveCommandInput, RetrieveCommandOutput } from "./commands/RetrieveCommand";
7378
import {
7479
ClientInputEndpointParameters,
@@ -91,7 +96,9 @@ export type ServiceInputTypes =
9196
| InvokeFlowCommandInput
9297
| InvokeInlineAgentCommandInput
9398
| OptimizePromptCommandInput
99+
| RerankCommandInput
94100
| RetrieveAndGenerateCommandInput
101+
| RetrieveAndGenerateStreamCommandInput
95102
| RetrieveCommandInput;
96103

97104
/**
@@ -104,7 +111,9 @@ export type ServiceOutputTypes =
104111
| InvokeFlowCommandOutput
105112
| InvokeInlineAgentCommandOutput
106113
| OptimizePromptCommandOutput
114+
| RerankCommandOutput
107115
| RetrieveAndGenerateCommandOutput
116+
| RetrieveAndGenerateStreamCommandOutput
108117
| RetrieveCommandOutput;
109118

110119
/**

Diff for: clients/client-bedrock-agent-runtime/src/commands/InvokeAgentCommand.ts

+45-2
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,43 @@ export interface InvokeAgentCommandOutput extends InvokeAgentResponse, __Metadat
188188
* "<RetrievalFilter>",
189189
* ],
190190
* },
191+
* rerankingConfiguration: { // VectorSearchRerankingConfiguration
192+
* type: "BEDROCK_RERANKING_MODEL", // required
193+
* bedrockRerankingConfiguration: { // VectorSearchBedrockRerankingConfiguration
194+
* modelConfiguration: { // VectorSearchBedrockRerankingModelConfiguration
195+
* modelArn: "STRING_VALUE", // required
196+
* additionalModelRequestFields: { // AdditionalModelRequestFields
197+
* "<keys>": "DOCUMENT_VALUE",
198+
* },
199+
* },
200+
* numberOfRerankedResults: Number("int"),
201+
* metadataConfiguration: { // MetadataConfigurationForReranking
202+
* selectionMode: "SELECTIVE" || "ALL", // required
203+
* selectiveModeConfiguration: { // RerankingMetadataSelectiveModeConfiguration Union: only one key present
204+
* fieldsToInclude: [ // FieldsForReranking
205+
* { // FieldForReranking
206+
* fieldName: "STRING_VALUE", // required
207+
* },
208+
* ],
209+
* fieldsToExclude: [
210+
* {
211+
* fieldName: "STRING_VALUE", // required
212+
* },
213+
* ],
214+
* },
215+
* },
216+
* },
217+
* },
218+
* implicitFilterConfiguration: { // ImplicitFilterConfiguration
219+
* metadataAttributes: [ // MetadataAttributeSchemaList // required
220+
* { // MetadataAttributeSchema
221+
* key: "STRING_VALUE", // required
222+
* type: "STRING" || "NUMBER" || "BOOLEAN" || "STRING_LIST", // required
223+
* description: "STRING_VALUE", // required
224+
* },
225+
* ],
226+
* modelArn: "STRING_VALUE", // required
227+
* },
191228
* },
192229
* },
193230
* },
@@ -229,7 +266,7 @@ export interface InvokeAgentCommandOutput extends InvokeAgentResponse, __Metadat
229266
* // text: "STRING_VALUE", // required
230267
* // },
231268
* // location: { // RetrievalResultLocation
232-
* // type: "S3" || "WEB" || "CONFLUENCE" || "SALESFORCE" || "SHAREPOINT", // required
269+
* // type: "S3" || "WEB" || "CONFLUENCE" || "SALESFORCE" || "SHAREPOINT" || "CUSTOM", // required
233270
* // s3Location: { // RetrievalResultS3Location
234271
* // uri: "STRING_VALUE",
235272
* // },
@@ -245,6 +282,9 @@ export interface InvokeAgentCommandOutput extends InvokeAgentResponse, __Metadat
245282
* // sharePointLocation: { // RetrievalResultSharePointLocation
246283
* // url: "STRING_VALUE",
247284
* // },
285+
* // customDocumentLocation: { // RetrievalResultCustomDocumentLocation
286+
* // id: "STRING_VALUE",
287+
* // },
248288
* // },
249289
* // metadata: { // RetrievalResultMetadata
250290
* // "<keys>": "DOCUMENT_VALUE",
@@ -463,7 +503,7 @@ export interface InvokeAgentCommandOutput extends InvokeAgentResponse, __Metadat
463503
* // text: "STRING_VALUE", // required
464504
* // },
465505
* // location: {
466-
* // type: "S3" || "WEB" || "CONFLUENCE" || "SALESFORCE" || "SHAREPOINT", // required
506+
* // type: "S3" || "WEB" || "CONFLUENCE" || "SALESFORCE" || "SHAREPOINT" || "CUSTOM", // required
467507
* // s3Location: {
468508
* // uri: "STRING_VALUE",
469509
* // },
@@ -479,6 +519,9 @@ export interface InvokeAgentCommandOutput extends InvokeAgentResponse, __Metadat
479519
* // sharePointLocation: {
480520
* // url: "STRING_VALUE",
481521
* // },
522+
* // customDocumentLocation: {
523+
* // id: "STRING_VALUE",
524+
* // },
482525
* // },
483526
* // metadata: {
484527
* // "<keys>": "DOCUMENT_VALUE",

Diff for: clients/client-bedrock-agent-runtime/src/commands/InvokeInlineAgentCommand.ts

+45-2
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,43 @@ export interface InvokeInlineAgentCommandOutput extends InvokeInlineAgentRespons
225225
* "<RetrievalFilter>",
226226
* ],
227227
* },
228+
* rerankingConfiguration: { // VectorSearchRerankingConfiguration
229+
* type: "BEDROCK_RERANKING_MODEL", // required
230+
* bedrockRerankingConfiguration: { // VectorSearchBedrockRerankingConfiguration
231+
* modelConfiguration: { // VectorSearchBedrockRerankingModelConfiguration
232+
* modelArn: "STRING_VALUE", // required
233+
* additionalModelRequestFields: { // AdditionalModelRequestFields
234+
* "<keys>": "DOCUMENT_VALUE",
235+
* },
236+
* },
237+
* numberOfRerankedResults: Number("int"),
238+
* metadataConfiguration: { // MetadataConfigurationForReranking
239+
* selectionMode: "SELECTIVE" || "ALL", // required
240+
* selectiveModeConfiguration: { // RerankingMetadataSelectiveModeConfiguration Union: only one key present
241+
* fieldsToInclude: [ // FieldsForReranking
242+
* { // FieldForReranking
243+
* fieldName: "STRING_VALUE", // required
244+
* },
245+
* ],
246+
* fieldsToExclude: [
247+
* {
248+
* fieldName: "STRING_VALUE", // required
249+
* },
250+
* ],
251+
* },
252+
* },
253+
* },
254+
* },
255+
* implicitFilterConfiguration: { // ImplicitFilterConfiguration
256+
* metadataAttributes: [ // MetadataAttributeSchemaList // required
257+
* { // MetadataAttributeSchema
258+
* key: "STRING_VALUE", // required
259+
* type: "STRING" || "NUMBER" || "BOOLEAN" || "STRING_LIST", // required
260+
* description: "STRING_VALUE", // required
261+
* },
262+
* ],
263+
* modelArn: "STRING_VALUE", // required
264+
* },
228265
* },
229266
* },
230267
* },
@@ -279,7 +316,7 @@ export interface InvokeInlineAgentCommandOutput extends InvokeInlineAgentRespons
279316
* // text: "STRING_VALUE", // required
280317
* // },
281318
* // location: { // RetrievalResultLocation
282-
* // type: "S3" || "WEB" || "CONFLUENCE" || "SALESFORCE" || "SHAREPOINT", // required
319+
* // type: "S3" || "WEB" || "CONFLUENCE" || "SALESFORCE" || "SHAREPOINT" || "CUSTOM", // required
283320
* // s3Location: { // RetrievalResultS3Location
284321
* // uri: "STRING_VALUE",
285322
* // },
@@ -295,6 +332,9 @@ export interface InvokeInlineAgentCommandOutput extends InvokeInlineAgentRespons
295332
* // sharePointLocation: { // RetrievalResultSharePointLocation
296333
* // url: "STRING_VALUE",
297334
* // },
335+
* // customDocumentLocation: { // RetrievalResultCustomDocumentLocation
336+
* // id: "STRING_VALUE",
337+
* // },
298338
* // },
299339
* // metadata: { // RetrievalResultMetadata
300340
* // "<keys>": "DOCUMENT_VALUE",
@@ -513,7 +553,7 @@ export interface InvokeInlineAgentCommandOutput extends InvokeInlineAgentRespons
513553
* // text: "STRING_VALUE", // required
514554
* // },
515555
* // location: {
516-
* // type: "S3" || "WEB" || "CONFLUENCE" || "SALESFORCE" || "SHAREPOINT", // required
556+
* // type: "S3" || "WEB" || "CONFLUENCE" || "SALESFORCE" || "SHAREPOINT" || "CUSTOM", // required
517557
* // s3Location: {
518558
* // uri: "STRING_VALUE",
519559
* // },
@@ -529,6 +569,9 @@ export interface InvokeInlineAgentCommandOutput extends InvokeInlineAgentRespons
529569
* // sharePointLocation: {
530570
* // url: "STRING_VALUE",
531571
* // },
572+
* // customDocumentLocation: {
573+
* // id: "STRING_VALUE",
574+
* // },
532575
* // },
533576
* // metadata: {
534577
* // "<keys>": "DOCUMENT_VALUE",

0 commit comments

Comments
 (0)