Skip to content

Commit 99b090b

Browse files
author
awstools
committed
feat(client-bedrock-agent-runtime): This release introduces the ability to generate SQL using natural language, through a new GenerateQuery API (with native integration into Knowledge Bases); ability to ingest and retrieve images through Bedrock Data Automation; and ability to create a Knowledge Base backed by Kendra GenAI Index.
1 parent ac7f368 commit 99b090b

File tree

13 files changed

+1155
-27
lines changed

13 files changed

+1155
-27
lines changed

clients/client-bedrock-agent-runtime/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,14 @@ DeleteAgentMemory
210210

211211
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock-agent-runtime/command/DeleteAgentMemoryCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-agent-runtime/Interface/DeleteAgentMemoryCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-agent-runtime/Interface/DeleteAgentMemoryCommandOutput/)
212212

213+
</details>
214+
<details>
215+
<summary>
216+
GenerateQuery
217+
</summary>
218+
219+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock-agent-runtime/command/GenerateQueryCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-agent-runtime/Interface/GenerateQueryCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-agent-runtime/Interface/GenerateQueryCommandOutput/)
220+
213221
</details>
214222
<details>
215223
<summary>

clients/client-bedrock-agent-runtime/src/BedrockAgentRuntime.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ import {
88
DeleteAgentMemoryCommandInput,
99
DeleteAgentMemoryCommandOutput,
1010
} from "./commands/DeleteAgentMemoryCommand";
11+
import {
12+
GenerateQueryCommand,
13+
GenerateQueryCommandInput,
14+
GenerateQueryCommandOutput,
15+
} from "./commands/GenerateQueryCommand";
1116
import {
1217
GetAgentMemoryCommand,
1318
GetAgentMemoryCommandInput,
@@ -40,6 +45,7 @@ import { RetrieveCommand, RetrieveCommandInput, RetrieveCommandOutput } from "./
4045

4146
const commands = {
4247
DeleteAgentMemoryCommand,
48+
GenerateQueryCommand,
4349
GetAgentMemoryCommand,
4450
InvokeAgentCommand,
4551
InvokeFlowCommand,
@@ -69,6 +75,17 @@ export interface BedrockAgentRuntime {
6975
cb: (err: any, data?: DeleteAgentMemoryCommandOutput) => void
7076
): void;
7177

78+
/**
79+
* @see {@link GenerateQueryCommand}
80+
*/
81+
generateQuery(args: GenerateQueryCommandInput, options?: __HttpHandlerOptions): Promise<GenerateQueryCommandOutput>;
82+
generateQuery(args: GenerateQueryCommandInput, cb: (err: any, data?: GenerateQueryCommandOutput) => void): void;
83+
generateQuery(
84+
args: GenerateQueryCommandInput,
85+
options: __HttpHandlerOptions,
86+
cb: (err: any, data?: GenerateQueryCommandOutput) => void
87+
): void;
88+
7289
/**
7390
* @see {@link GetAgentMemoryCommand}
7491
*/

clients/client-bedrock-agent-runtime/src/BedrockAgentRuntimeClient.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ import {
6060
resolveHttpAuthSchemeConfig,
6161
} from "./auth/httpAuthSchemeProvider";
6262
import { DeleteAgentMemoryCommandInput, DeleteAgentMemoryCommandOutput } from "./commands/DeleteAgentMemoryCommand";
63+
import { GenerateQueryCommandInput, GenerateQueryCommandOutput } from "./commands/GenerateQueryCommand";
6364
import { GetAgentMemoryCommandInput, GetAgentMemoryCommandOutput } from "./commands/GetAgentMemoryCommand";
6465
import { InvokeAgentCommandInput, InvokeAgentCommandOutput } from "./commands/InvokeAgentCommand";
6566
import { InvokeFlowCommandInput, InvokeFlowCommandOutput } from "./commands/InvokeFlowCommand";
@@ -91,6 +92,7 @@ export { __Client };
9192
*/
9293
export type ServiceInputTypes =
9394
| DeleteAgentMemoryCommandInput
95+
| GenerateQueryCommandInput
9496
| GetAgentMemoryCommandInput
9597
| InvokeAgentCommandInput
9698
| InvokeFlowCommandInput
@@ -106,6 +108,7 @@ export type ServiceInputTypes =
106108
*/
107109
export type ServiceOutputTypes =
108110
| DeleteAgentMemoryCommandOutput
111+
| GenerateQueryCommandOutput
109112
| GetAgentMemoryCommandOutput
110113
| InvokeAgentCommandOutput
111114
| InvokeFlowCommandOutput
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
// smithy-typescript generated code
2+
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
3+
import { getSerdePlugin } from "@smithy/middleware-serde";
4+
import { Command as $Command } from "@smithy/smithy-client";
5+
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
6+
7+
import {
8+
BedrockAgentRuntimeClientResolvedConfig,
9+
ServiceInputTypes,
10+
ServiceOutputTypes,
11+
} from "../BedrockAgentRuntimeClient";
12+
import { commonParams } from "../endpoint/EndpointParameters";
13+
import {
14+
GenerateQueryRequest,
15+
GenerateQueryRequestFilterSensitiveLog,
16+
GenerateQueryResponse,
17+
GenerateQueryResponseFilterSensitiveLog,
18+
} from "../models/models_0";
19+
import { de_GenerateQueryCommand, se_GenerateQueryCommand } from "../protocols/Aws_restJson1";
20+
21+
/**
22+
* @public
23+
*/
24+
export type { __MetadataBearer };
25+
export { $Command };
26+
/**
27+
* @public
28+
*
29+
* The input for {@link GenerateQueryCommand}.
30+
*/
31+
export interface GenerateQueryCommandInput extends GenerateQueryRequest {}
32+
/**
33+
* @public
34+
*
35+
* The output of {@link GenerateQueryCommand}.
36+
*/
37+
export interface GenerateQueryCommandOutput extends GenerateQueryResponse, __MetadataBearer {}
38+
39+
/**
40+
* <p>Generates an SQL query from a natural language query. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base-generate-query.html">Generate a query for structured data</a> in the Amazon Bedrock User Guide.</p>
41+
* @example
42+
* Use a bare-bones client and the command you need to make an API call.
43+
* ```javascript
44+
* import { BedrockAgentRuntimeClient, GenerateQueryCommand } from "@aws-sdk/client-bedrock-agent-runtime"; // ES Modules import
45+
* // const { BedrockAgentRuntimeClient, GenerateQueryCommand } = require("@aws-sdk/client-bedrock-agent-runtime"); // CommonJS import
46+
* const client = new BedrockAgentRuntimeClient(config);
47+
* const input = { // GenerateQueryRequest
48+
* queryGenerationInput: { // QueryGenerationInput
49+
* type: "TEXT", // required
50+
* text: "STRING_VALUE", // required
51+
* },
52+
* transformationConfiguration: { // TransformationConfiguration
53+
* mode: "TEXT_TO_SQL", // required
54+
* textToSqlConfiguration: { // TextToSqlConfiguration
55+
* type: "KNOWLEDGE_BASE", // required
56+
* knowledgeBaseConfiguration: { // TextToSqlKnowledgeBaseConfiguration
57+
* knowledgeBaseArn: "STRING_VALUE", // required
58+
* },
59+
* },
60+
* },
61+
* };
62+
* const command = new GenerateQueryCommand(input);
63+
* const response = await client.send(command);
64+
* // { // GenerateQueryResponse
65+
* // queries: [ // GeneratedQueries
66+
* // { // GeneratedQuery
67+
* // type: "REDSHIFT_SQL",
68+
* // sql: "STRING_VALUE",
69+
* // },
70+
* // ],
71+
* // };
72+
*
73+
* ```
74+
*
75+
* @param GenerateQueryCommandInput - {@link GenerateQueryCommandInput}
76+
* @returns {@link GenerateQueryCommandOutput}
77+
* @see {@link GenerateQueryCommandInput} for command's `input` shape.
78+
* @see {@link GenerateQueryCommandOutput} for command's `response` shape.
79+
* @see {@link BedrockAgentRuntimeClientResolvedConfig | config} for BedrockAgentRuntimeClient's `config` shape.
80+
*
81+
* @throws {@link AccessDeniedException} (client fault)
82+
* <p>The request is denied because of missing access permissions. Check your permissions and retry your request.</p>
83+
*
84+
* @throws {@link BadGatewayException} (server fault)
85+
* <p>There was an issue with a dependency due to a server issue. Retry your request.</p>
86+
*
87+
* @throws {@link ConflictException} (client fault)
88+
* <p>There was a conflict performing an operation. Resolve the conflict and retry your request.</p>
89+
*
90+
* @throws {@link DependencyFailedException} (client fault)
91+
* <p>There was an issue with a dependency. Check the resource configurations and retry the request.</p>
92+
*
93+
* @throws {@link InternalServerException} (server fault)
94+
* <p>An internal server error occurred. Retry your request.</p>
95+
*
96+
* @throws {@link ResourceNotFoundException} (client fault)
97+
* <p>The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.</p>
98+
*
99+
* @throws {@link ServiceQuotaExceededException} (client fault)
100+
* <p>The number of requests exceeds the service quota. Resubmit your request later.</p>
101+
*
102+
* @throws {@link ThrottlingException} (client fault)
103+
* <p>The number of requests exceeds the limit. Resubmit your request later.</p>
104+
*
105+
* @throws {@link ValidationException} (client fault)
106+
* <p>Input validation failed. Check your request parameters and retry the request.</p>
107+
*
108+
* @throws {@link BedrockAgentRuntimeServiceException}
109+
* <p>Base exception class for all service exceptions from BedrockAgentRuntime service.</p>
110+
*
111+
* @public
112+
*/
113+
export class GenerateQueryCommand extends $Command
114+
.classBuilder<
115+
GenerateQueryCommandInput,
116+
GenerateQueryCommandOutput,
117+
BedrockAgentRuntimeClientResolvedConfig,
118+
ServiceInputTypes,
119+
ServiceOutputTypes
120+
>()
121+
.ep(commonParams)
122+
.m(function (this: any, Command: any, cs: any, config: BedrockAgentRuntimeClientResolvedConfig, o: any) {
123+
return [
124+
getSerdePlugin(config, this.serialize, this.deserialize),
125+
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
126+
];
127+
})
128+
.s("AmazonBedrockAgentRunTimeService", "GenerateQuery", {})
129+
.n("BedrockAgentRuntimeClient", "GenerateQueryCommand")
130+
.f(GenerateQueryRequestFilterSensitiveLog, GenerateQueryResponseFilterSensitiveLog)
131+
.ser(se_GenerateQueryCommand)
132+
.de(de_GenerateQueryCommand)
133+
.build() {
134+
/** @internal type navigation helper, not in runtime. */
135+
protected declare static __types: {
136+
api: {
137+
input: GenerateQueryRequest;
138+
output: GenerateQueryResponse;
139+
};
140+
sdk: {
141+
input: GenerateQueryCommandInput;
142+
output: GenerateQueryCommandOutput;
143+
};
144+
};
145+
}

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

Lines changed: 51 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -278,10 +278,19 @@ export interface InvokeAgentCommandOutput extends InvokeAgentResponse, __Metadat
278278
* // retrievedReferences: [ // RetrievedReferences
279279
* // { // RetrievedReference
280280
* // content: { // RetrievalResultContent
281-
* // text: "STRING_VALUE", // required
281+
* // type: "TEXT" || "IMAGE" || "ROW",
282+
* // text: "STRING_VALUE",
283+
* // byteContent: "STRING_VALUE",
284+
* // row: [ // RetrievalResultContentRow
285+
* // { // RetrievalResultContentColumn
286+
* // columnName: "STRING_VALUE",
287+
* // columnValue: "STRING_VALUE",
288+
* // type: "BLOB" || "BOOLEAN" || "DOUBLE" || "NULL" || "LONG" || "STRING",
289+
* // },
290+
* // ],
282291
* // },
283292
* // location: { // RetrievalResultLocation
284-
* // type: "S3" || "WEB" || "CONFLUENCE" || "SALESFORCE" || "SHAREPOINT" || "CUSTOM", // required
293+
* // type: "S3" || "WEB" || "CONFLUENCE" || "SALESFORCE" || "SHAREPOINT" || "CUSTOM" || "KENDRA" || "SQL", // required
285294
* // s3Location: { // RetrievalResultS3Location
286295
* // uri: "STRING_VALUE",
287296
* // },
@@ -300,6 +309,12 @@ export interface InvokeAgentCommandOutput extends InvokeAgentResponse, __Metadat
300309
* // customDocumentLocation: { // RetrievalResultCustomDocumentLocation
301310
* // id: "STRING_VALUE",
302311
* // },
312+
* // kendraDocumentLocation: { // RetrievalResultKendraDocumentLocation
313+
* // uri: "STRING_VALUE",
314+
* // },
315+
* // sqlLocation: { // RetrievalResultSqlLocation
316+
* // query: "STRING_VALUE",
317+
* // },
303318
* // },
304319
* // metadata: { // RetrievalResultMetadata
305320
* // "<keys>": "DOCUMENT_VALUE",
@@ -610,10 +625,19 @@ export interface InvokeAgentCommandOutput extends InvokeAgentResponse, __Metadat
610625
* // retrievedReferences: [
611626
* // {
612627
* // content: {
613-
* // text: "STRING_VALUE", // required
628+
* // type: "TEXT" || "IMAGE" || "ROW",
629+
* // text: "STRING_VALUE",
630+
* // byteContent: "STRING_VALUE",
631+
* // row: [
632+
* // {
633+
* // columnName: "STRING_VALUE",
634+
* // columnValue: "STRING_VALUE",
635+
* // type: "BLOB" || "BOOLEAN" || "DOUBLE" || "NULL" || "LONG" || "STRING",
636+
* // },
637+
* // ],
614638
* // },
615639
* // location: {
616-
* // type: "S3" || "WEB" || "CONFLUENCE" || "SALESFORCE" || "SHAREPOINT" || "CUSTOM", // required
640+
* // type: "S3" || "WEB" || "CONFLUENCE" || "SALESFORCE" || "SHAREPOINT" || "CUSTOM" || "KENDRA" || "SQL", // required
617641
* // s3Location: {
618642
* // uri: "STRING_VALUE",
619643
* // },
@@ -632,6 +656,12 @@ export interface InvokeAgentCommandOutput extends InvokeAgentResponse, __Metadat
632656
* // customDocumentLocation: {
633657
* // id: "STRING_VALUE",
634658
* // },
659+
* // kendraDocumentLocation: {
660+
* // uri: "STRING_VALUE",
661+
* // },
662+
* // sqlLocation: {
663+
* // query: "STRING_VALUE",
664+
* // },
635665
* // },
636666
* // metadata: {
637667
* // "<keys>": "DOCUMENT_VALUE",
@@ -858,10 +888,19 @@ export interface InvokeAgentCommandOutput extends InvokeAgentResponse, __Metadat
858888
* // retrievedReferences: [
859889
* // {
860890
* // content: {
861-
* // text: "STRING_VALUE", // required
891+
* // type: "TEXT" || "IMAGE" || "ROW",
892+
* // text: "STRING_VALUE",
893+
* // byteContent: "STRING_VALUE",
894+
* // row: [
895+
* // {
896+
* // columnName: "STRING_VALUE",
897+
* // columnValue: "STRING_VALUE",
898+
* // type: "BLOB" || "BOOLEAN" || "DOUBLE" || "NULL" || "LONG" || "STRING",
899+
* // },
900+
* // ],
862901
* // },
863902
* // location: {
864-
* // type: "S3" || "WEB" || "CONFLUENCE" || "SALESFORCE" || "SHAREPOINT" || "CUSTOM", // required
903+
* // type: "S3" || "WEB" || "CONFLUENCE" || "SALESFORCE" || "SHAREPOINT" || "CUSTOM" || "KENDRA" || "SQL", // required
865904
* // s3Location: {
866905
* // uri: "STRING_VALUE",
867906
* // },
@@ -880,6 +919,12 @@ export interface InvokeAgentCommandOutput extends InvokeAgentResponse, __Metadat
880919
* // customDocumentLocation: {
881920
* // id: "STRING_VALUE",
882921
* // },
922+
* // kendraDocumentLocation: {
923+
* // uri: "STRING_VALUE",
924+
* // },
925+
* // sqlLocation: {
926+
* // query: "STRING_VALUE",
927+
* // },
883928
* // },
884929
* // metadata: {
885930
* // "<keys>": "DOCUMENT_VALUE",

0 commit comments

Comments
 (0)