From 99b090be601f3a9eaf3943904f192ea531f16342 Mon Sep 17 00:00:00 2001 From: awstools Date: Wed, 4 Dec 2024 19:16:19 +0000 Subject: [PATCH] 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. --- .../client-bedrock-agent-runtime/README.md | 8 + .../src/BedrockAgentRuntime.ts | 17 + .../src/BedrockAgentRuntimeClient.ts | 3 + .../src/commands/GenerateQueryCommand.ts | 145 ++++++ .../src/commands/InvokeAgentCommand.ts | 57 ++- .../src/commands/InvokeInlineAgentCommand.ts | 57 ++- .../commands/RetrieveAndGenerateCommand.ts | 19 +- .../RetrieveAndGenerateStreamCommand.ts | 19 +- .../src/commands/RetrieveCommand.ts | 19 +- .../src/commands/index.ts | 1 + .../src/models/models_0.ts | 324 ++++++++++++- .../src/protocols/Aws_restJson1.ts | 69 +++ .../aws-models/bedrock-agent-runtime.json | 444 +++++++++++++++++- 13 files changed, 1155 insertions(+), 27 deletions(-) create mode 100644 clients/client-bedrock-agent-runtime/src/commands/GenerateQueryCommand.ts diff --git a/clients/client-bedrock-agent-runtime/README.md b/clients/client-bedrock-agent-runtime/README.md index d14aa8f598b9..f4b0060f3a36 100644 --- a/clients/client-bedrock-agent-runtime/README.md +++ b/clients/client-bedrock-agent-runtime/README.md @@ -210,6 +210,14 @@ DeleteAgentMemory [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/) + +
+ +GenerateQuery + + +[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/) +
diff --git a/clients/client-bedrock-agent-runtime/src/BedrockAgentRuntime.ts b/clients/client-bedrock-agent-runtime/src/BedrockAgentRuntime.ts index e8e1c0c00987..90b8b58b3549 100644 --- a/clients/client-bedrock-agent-runtime/src/BedrockAgentRuntime.ts +++ b/clients/client-bedrock-agent-runtime/src/BedrockAgentRuntime.ts @@ -8,6 +8,11 @@ import { DeleteAgentMemoryCommandInput, DeleteAgentMemoryCommandOutput, } from "./commands/DeleteAgentMemoryCommand"; +import { + GenerateQueryCommand, + GenerateQueryCommandInput, + GenerateQueryCommandOutput, +} from "./commands/GenerateQueryCommand"; import { GetAgentMemoryCommand, GetAgentMemoryCommandInput, @@ -40,6 +45,7 @@ import { RetrieveCommand, RetrieveCommandInput, RetrieveCommandOutput } from "./ const commands = { DeleteAgentMemoryCommand, + GenerateQueryCommand, GetAgentMemoryCommand, InvokeAgentCommand, InvokeFlowCommand, @@ -69,6 +75,17 @@ export interface BedrockAgentRuntime { cb: (err: any, data?: DeleteAgentMemoryCommandOutput) => void ): void; + /** + * @see {@link GenerateQueryCommand} + */ + generateQuery(args: GenerateQueryCommandInput, options?: __HttpHandlerOptions): Promise; + generateQuery(args: GenerateQueryCommandInput, cb: (err: any, data?: GenerateQueryCommandOutput) => void): void; + generateQuery( + args: GenerateQueryCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: GenerateQueryCommandOutput) => void + ): void; + /** * @see {@link GetAgentMemoryCommand} */ diff --git a/clients/client-bedrock-agent-runtime/src/BedrockAgentRuntimeClient.ts b/clients/client-bedrock-agent-runtime/src/BedrockAgentRuntimeClient.ts index a3486509db29..e88b2dc89c8a 100644 --- a/clients/client-bedrock-agent-runtime/src/BedrockAgentRuntimeClient.ts +++ b/clients/client-bedrock-agent-runtime/src/BedrockAgentRuntimeClient.ts @@ -60,6 +60,7 @@ import { resolveHttpAuthSchemeConfig, } from "./auth/httpAuthSchemeProvider"; import { DeleteAgentMemoryCommandInput, DeleteAgentMemoryCommandOutput } from "./commands/DeleteAgentMemoryCommand"; +import { GenerateQueryCommandInput, GenerateQueryCommandOutput } from "./commands/GenerateQueryCommand"; import { GetAgentMemoryCommandInput, GetAgentMemoryCommandOutput } from "./commands/GetAgentMemoryCommand"; import { InvokeAgentCommandInput, InvokeAgentCommandOutput } from "./commands/InvokeAgentCommand"; import { InvokeFlowCommandInput, InvokeFlowCommandOutput } from "./commands/InvokeFlowCommand"; @@ -91,6 +92,7 @@ export { __Client }; */ export type ServiceInputTypes = | DeleteAgentMemoryCommandInput + | GenerateQueryCommandInput | GetAgentMemoryCommandInput | InvokeAgentCommandInput | InvokeFlowCommandInput @@ -106,6 +108,7 @@ export type ServiceInputTypes = */ export type ServiceOutputTypes = | DeleteAgentMemoryCommandOutput + | GenerateQueryCommandOutput | GetAgentMemoryCommandOutput | InvokeAgentCommandOutput | InvokeFlowCommandOutput diff --git a/clients/client-bedrock-agent-runtime/src/commands/GenerateQueryCommand.ts b/clients/client-bedrock-agent-runtime/src/commands/GenerateQueryCommand.ts new file mode 100644 index 000000000000..bcc98d257c6e --- /dev/null +++ b/clients/client-bedrock-agent-runtime/src/commands/GenerateQueryCommand.ts @@ -0,0 +1,145 @@ +// smithy-typescript generated code +import { getEndpointPlugin } from "@smithy/middleware-endpoint"; +import { getSerdePlugin } from "@smithy/middleware-serde"; +import { Command as $Command } from "@smithy/smithy-client"; +import { MetadataBearer as __MetadataBearer } from "@smithy/types"; + +import { + BedrockAgentRuntimeClientResolvedConfig, + ServiceInputTypes, + ServiceOutputTypes, +} from "../BedrockAgentRuntimeClient"; +import { commonParams } from "../endpoint/EndpointParameters"; +import { + GenerateQueryRequest, + GenerateQueryRequestFilterSensitiveLog, + GenerateQueryResponse, + GenerateQueryResponseFilterSensitiveLog, +} from "../models/models_0"; +import { de_GenerateQueryCommand, se_GenerateQueryCommand } from "../protocols/Aws_restJson1"; + +/** + * @public + */ +export type { __MetadataBearer }; +export { $Command }; +/** + * @public + * + * The input for {@link GenerateQueryCommand}. + */ +export interface GenerateQueryCommandInput extends GenerateQueryRequest {} +/** + * @public + * + * The output of {@link GenerateQueryCommand}. + */ +export interface GenerateQueryCommandOutput extends GenerateQueryResponse, __MetadataBearer {} + +/** + *

Generates an SQL query from a natural language query. For more information, see Generate a query for structured data in the Amazon Bedrock User Guide.

+ * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { BedrockAgentRuntimeClient, GenerateQueryCommand } from "@aws-sdk/client-bedrock-agent-runtime"; // ES Modules import + * // const { BedrockAgentRuntimeClient, GenerateQueryCommand } = require("@aws-sdk/client-bedrock-agent-runtime"); // CommonJS import + * const client = new BedrockAgentRuntimeClient(config); + * const input = { // GenerateQueryRequest + * queryGenerationInput: { // QueryGenerationInput + * type: "TEXT", // required + * text: "STRING_VALUE", // required + * }, + * transformationConfiguration: { // TransformationConfiguration + * mode: "TEXT_TO_SQL", // required + * textToSqlConfiguration: { // TextToSqlConfiguration + * type: "KNOWLEDGE_BASE", // required + * knowledgeBaseConfiguration: { // TextToSqlKnowledgeBaseConfiguration + * knowledgeBaseArn: "STRING_VALUE", // required + * }, + * }, + * }, + * }; + * const command = new GenerateQueryCommand(input); + * const response = await client.send(command); + * // { // GenerateQueryResponse + * // queries: [ // GeneratedQueries + * // { // GeneratedQuery + * // type: "REDSHIFT_SQL", + * // sql: "STRING_VALUE", + * // }, + * // ], + * // }; + * + * ``` + * + * @param GenerateQueryCommandInput - {@link GenerateQueryCommandInput} + * @returns {@link GenerateQueryCommandOutput} + * @see {@link GenerateQueryCommandInput} for command's `input` shape. + * @see {@link GenerateQueryCommandOutput} for command's `response` shape. + * @see {@link BedrockAgentRuntimeClientResolvedConfig | config} for BedrockAgentRuntimeClient's `config` shape. + * + * @throws {@link AccessDeniedException} (client fault) + *

The request is denied because of missing access permissions. Check your permissions and retry your request.

+ * + * @throws {@link BadGatewayException} (server fault) + *

There was an issue with a dependency due to a server issue. Retry your request.

+ * + * @throws {@link ConflictException} (client fault) + *

There was a conflict performing an operation. Resolve the conflict and retry your request.

+ * + * @throws {@link DependencyFailedException} (client fault) + *

There was an issue with a dependency. Check the resource configurations and retry the request.

+ * + * @throws {@link InternalServerException} (server fault) + *

An internal server error occurred. Retry your request.

+ * + * @throws {@link ResourceNotFoundException} (client fault) + *

The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.

+ * + * @throws {@link ServiceQuotaExceededException} (client fault) + *

The number of requests exceeds the service quota. Resubmit your request later.

+ * + * @throws {@link ThrottlingException} (client fault) + *

The number of requests exceeds the limit. Resubmit your request later.

+ * + * @throws {@link ValidationException} (client fault) + *

Input validation failed. Check your request parameters and retry the request.

+ * + * @throws {@link BedrockAgentRuntimeServiceException} + *

Base exception class for all service exceptions from BedrockAgentRuntime service.

+ * + * @public + */ +export class GenerateQueryCommand extends $Command + .classBuilder< + GenerateQueryCommandInput, + GenerateQueryCommandOutput, + BedrockAgentRuntimeClientResolvedConfig, + ServiceInputTypes, + ServiceOutputTypes + >() + .ep(commonParams) + .m(function (this: any, Command: any, cs: any, config: BedrockAgentRuntimeClientResolvedConfig, o: any) { + return [ + getSerdePlugin(config, this.serialize, this.deserialize), + getEndpointPlugin(config, Command.getEndpointParameterInstructions()), + ]; + }) + .s("AmazonBedrockAgentRunTimeService", "GenerateQuery", {}) + .n("BedrockAgentRuntimeClient", "GenerateQueryCommand") + .f(GenerateQueryRequestFilterSensitiveLog, GenerateQueryResponseFilterSensitiveLog) + .ser(se_GenerateQueryCommand) + .de(de_GenerateQueryCommand) + .build() { + /** @internal type navigation helper, not in runtime. */ + protected declare static __types: { + api: { + input: GenerateQueryRequest; + output: GenerateQueryResponse; + }; + sdk: { + input: GenerateQueryCommandInput; + output: GenerateQueryCommandOutput; + }; + }; +} diff --git a/clients/client-bedrock-agent-runtime/src/commands/InvokeAgentCommand.ts b/clients/client-bedrock-agent-runtime/src/commands/InvokeAgentCommand.ts index 159eeea1ed23..547b38a2ef10 100644 --- a/clients/client-bedrock-agent-runtime/src/commands/InvokeAgentCommand.ts +++ b/clients/client-bedrock-agent-runtime/src/commands/InvokeAgentCommand.ts @@ -278,10 +278,19 @@ export interface InvokeAgentCommandOutput extends InvokeAgentResponse, __Metadat * // retrievedReferences: [ // RetrievedReferences * // { // RetrievedReference * // content: { // RetrievalResultContent - * // text: "STRING_VALUE", // required + * // type: "TEXT" || "IMAGE" || "ROW", + * // text: "STRING_VALUE", + * // byteContent: "STRING_VALUE", + * // row: [ // RetrievalResultContentRow + * // { // RetrievalResultContentColumn + * // columnName: "STRING_VALUE", + * // columnValue: "STRING_VALUE", + * // type: "BLOB" || "BOOLEAN" || "DOUBLE" || "NULL" || "LONG" || "STRING", + * // }, + * // ], * // }, * // location: { // RetrievalResultLocation - * // type: "S3" || "WEB" || "CONFLUENCE" || "SALESFORCE" || "SHAREPOINT" || "CUSTOM", // required + * // type: "S3" || "WEB" || "CONFLUENCE" || "SALESFORCE" || "SHAREPOINT" || "CUSTOM" || "KENDRA" || "SQL", // required * // s3Location: { // RetrievalResultS3Location * // uri: "STRING_VALUE", * // }, @@ -300,6 +309,12 @@ export interface InvokeAgentCommandOutput extends InvokeAgentResponse, __Metadat * // customDocumentLocation: { // RetrievalResultCustomDocumentLocation * // id: "STRING_VALUE", * // }, + * // kendraDocumentLocation: { // RetrievalResultKendraDocumentLocation + * // uri: "STRING_VALUE", + * // }, + * // sqlLocation: { // RetrievalResultSqlLocation + * // query: "STRING_VALUE", + * // }, * // }, * // metadata: { // RetrievalResultMetadata * // "": "DOCUMENT_VALUE", @@ -610,10 +625,19 @@ export interface InvokeAgentCommandOutput extends InvokeAgentResponse, __Metadat * // retrievedReferences: [ * // { * // content: { - * // text: "STRING_VALUE", // required + * // type: "TEXT" || "IMAGE" || "ROW", + * // text: "STRING_VALUE", + * // byteContent: "STRING_VALUE", + * // row: [ + * // { + * // columnName: "STRING_VALUE", + * // columnValue: "STRING_VALUE", + * // type: "BLOB" || "BOOLEAN" || "DOUBLE" || "NULL" || "LONG" || "STRING", + * // }, + * // ], * // }, * // location: { - * // type: "S3" || "WEB" || "CONFLUENCE" || "SALESFORCE" || "SHAREPOINT" || "CUSTOM", // required + * // type: "S3" || "WEB" || "CONFLUENCE" || "SALESFORCE" || "SHAREPOINT" || "CUSTOM" || "KENDRA" || "SQL", // required * // s3Location: { * // uri: "STRING_VALUE", * // }, @@ -632,6 +656,12 @@ export interface InvokeAgentCommandOutput extends InvokeAgentResponse, __Metadat * // customDocumentLocation: { * // id: "STRING_VALUE", * // }, + * // kendraDocumentLocation: { + * // uri: "STRING_VALUE", + * // }, + * // sqlLocation: { + * // query: "STRING_VALUE", + * // }, * // }, * // metadata: { * // "": "DOCUMENT_VALUE", @@ -858,10 +888,19 @@ export interface InvokeAgentCommandOutput extends InvokeAgentResponse, __Metadat * // retrievedReferences: [ * // { * // content: { - * // text: "STRING_VALUE", // required + * // type: "TEXT" || "IMAGE" || "ROW", + * // text: "STRING_VALUE", + * // byteContent: "STRING_VALUE", + * // row: [ + * // { + * // columnName: "STRING_VALUE", + * // columnValue: "STRING_VALUE", + * // type: "BLOB" || "BOOLEAN" || "DOUBLE" || "NULL" || "LONG" || "STRING", + * // }, + * // ], * // }, * // location: { - * // type: "S3" || "WEB" || "CONFLUENCE" || "SALESFORCE" || "SHAREPOINT" || "CUSTOM", // required + * // type: "S3" || "WEB" || "CONFLUENCE" || "SALESFORCE" || "SHAREPOINT" || "CUSTOM" || "KENDRA" || "SQL", // required * // s3Location: { * // uri: "STRING_VALUE", * // }, @@ -880,6 +919,12 @@ export interface InvokeAgentCommandOutput extends InvokeAgentResponse, __Metadat * // customDocumentLocation: { * // id: "STRING_VALUE", * // }, + * // kendraDocumentLocation: { + * // uri: "STRING_VALUE", + * // }, + * // sqlLocation: { + * // query: "STRING_VALUE", + * // }, * // }, * // metadata: { * // "": "DOCUMENT_VALUE", diff --git a/clients/client-bedrock-agent-runtime/src/commands/InvokeInlineAgentCommand.ts b/clients/client-bedrock-agent-runtime/src/commands/InvokeInlineAgentCommand.ts index 1eb36e6def9e..f75823cdf90a 100644 --- a/clients/client-bedrock-agent-runtime/src/commands/InvokeInlineAgentCommand.ts +++ b/clients/client-bedrock-agent-runtime/src/commands/InvokeInlineAgentCommand.ts @@ -315,10 +315,19 @@ export interface InvokeInlineAgentCommandOutput extends InvokeInlineAgentRespons * // retrievedReferences: [ // RetrievedReferences * // { // RetrievedReference * // content: { // RetrievalResultContent - * // text: "STRING_VALUE", // required + * // type: "TEXT" || "IMAGE" || "ROW", + * // text: "STRING_VALUE", + * // byteContent: "STRING_VALUE", + * // row: [ // RetrievalResultContentRow + * // { // RetrievalResultContentColumn + * // columnName: "STRING_VALUE", + * // columnValue: "STRING_VALUE", + * // type: "BLOB" || "BOOLEAN" || "DOUBLE" || "NULL" || "LONG" || "STRING", + * // }, + * // ], * // }, * // location: { // RetrievalResultLocation - * // type: "S3" || "WEB" || "CONFLUENCE" || "SALESFORCE" || "SHAREPOINT" || "CUSTOM", // required + * // type: "S3" || "WEB" || "CONFLUENCE" || "SALESFORCE" || "SHAREPOINT" || "CUSTOM" || "KENDRA" || "SQL", // required * // s3Location: { // RetrievalResultS3Location * // uri: "STRING_VALUE", * // }, @@ -337,6 +346,12 @@ export interface InvokeInlineAgentCommandOutput extends InvokeInlineAgentRespons * // customDocumentLocation: { // RetrievalResultCustomDocumentLocation * // id: "STRING_VALUE", * // }, + * // kendraDocumentLocation: { // RetrievalResultKendraDocumentLocation + * // uri: "STRING_VALUE", + * // }, + * // sqlLocation: { // RetrievalResultSqlLocation + * // query: "STRING_VALUE", + * // }, * // }, * // metadata: { // RetrievalResultMetadata * // "": "DOCUMENT_VALUE", @@ -647,10 +662,19 @@ export interface InvokeInlineAgentCommandOutput extends InvokeInlineAgentRespons * // retrievedReferences: [ * // { * // content: { - * // text: "STRING_VALUE", // required + * // type: "TEXT" || "IMAGE" || "ROW", + * // text: "STRING_VALUE", + * // byteContent: "STRING_VALUE", + * // row: [ + * // { + * // columnName: "STRING_VALUE", + * // columnValue: "STRING_VALUE", + * // type: "BLOB" || "BOOLEAN" || "DOUBLE" || "NULL" || "LONG" || "STRING", + * // }, + * // ], * // }, * // location: { - * // type: "S3" || "WEB" || "CONFLUENCE" || "SALESFORCE" || "SHAREPOINT" || "CUSTOM", // required + * // type: "S3" || "WEB" || "CONFLUENCE" || "SALESFORCE" || "SHAREPOINT" || "CUSTOM" || "KENDRA" || "SQL", // required * // s3Location: { * // uri: "STRING_VALUE", * // }, @@ -669,6 +693,12 @@ export interface InvokeInlineAgentCommandOutput extends InvokeInlineAgentRespons * // customDocumentLocation: { * // id: "STRING_VALUE", * // }, + * // kendraDocumentLocation: { + * // uri: "STRING_VALUE", + * // }, + * // sqlLocation: { + * // query: "STRING_VALUE", + * // }, * // }, * // metadata: { * // "": "DOCUMENT_VALUE", @@ -895,10 +925,19 @@ export interface InvokeInlineAgentCommandOutput extends InvokeInlineAgentRespons * // retrievedReferences: [ * // { * // content: { - * // text: "STRING_VALUE", // required + * // type: "TEXT" || "IMAGE" || "ROW", + * // text: "STRING_VALUE", + * // byteContent: "STRING_VALUE", + * // row: [ + * // { + * // columnName: "STRING_VALUE", + * // columnValue: "STRING_VALUE", + * // type: "BLOB" || "BOOLEAN" || "DOUBLE" || "NULL" || "LONG" || "STRING", + * // }, + * // ], * // }, * // location: { - * // type: "S3" || "WEB" || "CONFLUENCE" || "SALESFORCE" || "SHAREPOINT" || "CUSTOM", // required + * // type: "S3" || "WEB" || "CONFLUENCE" || "SALESFORCE" || "SHAREPOINT" || "CUSTOM" || "KENDRA" || "SQL", // required * // s3Location: { * // uri: "STRING_VALUE", * // }, @@ -917,6 +956,12 @@ export interface InvokeInlineAgentCommandOutput extends InvokeInlineAgentRespons * // customDocumentLocation: { * // id: "STRING_VALUE", * // }, + * // kendraDocumentLocation: { + * // uri: "STRING_VALUE", + * // }, + * // sqlLocation: { + * // query: "STRING_VALUE", + * // }, * // }, * // metadata: { * // "": "DOCUMENT_VALUE", diff --git a/clients/client-bedrock-agent-runtime/src/commands/RetrieveAndGenerateCommand.ts b/clients/client-bedrock-agent-runtime/src/commands/RetrieveAndGenerateCommand.ts index 93dc54f48b93..59151eae6935 100644 --- a/clients/client-bedrock-agent-runtime/src/commands/RetrieveAndGenerateCommand.ts +++ b/clients/client-bedrock-agent-runtime/src/commands/RetrieveAndGenerateCommand.ts @@ -257,10 +257,19 @@ export interface RetrieveAndGenerateCommandOutput extends RetrieveAndGenerateRes * // retrievedReferences: [ // RetrievedReferences * // { // RetrievedReference * // content: { // RetrievalResultContent - * // text: "STRING_VALUE", // required + * // type: "TEXT" || "IMAGE" || "ROW", + * // text: "STRING_VALUE", + * // byteContent: "STRING_VALUE", + * // row: [ // RetrievalResultContentRow + * // { // RetrievalResultContentColumn + * // columnName: "STRING_VALUE", + * // columnValue: "STRING_VALUE", + * // type: "BLOB" || "BOOLEAN" || "DOUBLE" || "NULL" || "LONG" || "STRING", + * // }, + * // ], * // }, * // location: { // RetrievalResultLocation - * // type: "S3" || "WEB" || "CONFLUENCE" || "SALESFORCE" || "SHAREPOINT" || "CUSTOM", // required + * // type: "S3" || "WEB" || "CONFLUENCE" || "SALESFORCE" || "SHAREPOINT" || "CUSTOM" || "KENDRA" || "SQL", // required * // s3Location: { // RetrievalResultS3Location * // uri: "STRING_VALUE", * // }, @@ -279,6 +288,12 @@ export interface RetrieveAndGenerateCommandOutput extends RetrieveAndGenerateRes * // customDocumentLocation: { // RetrievalResultCustomDocumentLocation * // id: "STRING_VALUE", * // }, + * // kendraDocumentLocation: { // RetrievalResultKendraDocumentLocation + * // uri: "STRING_VALUE", + * // }, + * // sqlLocation: { // RetrievalResultSqlLocation + * // query: "STRING_VALUE", + * // }, * // }, * // metadata: { // RetrievalResultMetadata * // "": "DOCUMENT_VALUE", diff --git a/clients/client-bedrock-agent-runtime/src/commands/RetrieveAndGenerateStreamCommand.ts b/clients/client-bedrock-agent-runtime/src/commands/RetrieveAndGenerateStreamCommand.ts index 385bae08a47e..fb12fde16d15 100644 --- a/clients/client-bedrock-agent-runtime/src/commands/RetrieveAndGenerateStreamCommand.ts +++ b/clients/client-bedrock-agent-runtime/src/commands/RetrieveAndGenerateStreamCommand.ts @@ -260,10 +260,19 @@ export interface RetrieveAndGenerateStreamCommandOutput extends RetrieveAndGener * // retrievedReferences: [ // RetrievedReferences * // { // RetrievedReference * // content: { // RetrievalResultContent - * // text: "STRING_VALUE", // required + * // type: "TEXT" || "IMAGE" || "ROW", + * // text: "STRING_VALUE", + * // byteContent: "STRING_VALUE", + * // row: [ // RetrievalResultContentRow + * // { // RetrievalResultContentColumn + * // columnName: "STRING_VALUE", + * // columnValue: "STRING_VALUE", + * // type: "BLOB" || "BOOLEAN" || "DOUBLE" || "NULL" || "LONG" || "STRING", + * // }, + * // ], * // }, * // location: { // RetrievalResultLocation - * // type: "S3" || "WEB" || "CONFLUENCE" || "SALESFORCE" || "SHAREPOINT" || "CUSTOM", // required + * // type: "S3" || "WEB" || "CONFLUENCE" || "SALESFORCE" || "SHAREPOINT" || "CUSTOM" || "KENDRA" || "SQL", // required * // s3Location: { // RetrievalResultS3Location * // uri: "STRING_VALUE", * // }, @@ -282,6 +291,12 @@ export interface RetrieveAndGenerateStreamCommandOutput extends RetrieveAndGener * // customDocumentLocation: { // RetrievalResultCustomDocumentLocation * // id: "STRING_VALUE", * // }, + * // kendraDocumentLocation: { // RetrievalResultKendraDocumentLocation + * // uri: "STRING_VALUE", + * // }, + * // sqlLocation: { // RetrievalResultSqlLocation + * // query: "STRING_VALUE", + * // }, * // }, * // metadata: { // RetrievalResultMetadata * // "": "DOCUMENT_VALUE", diff --git a/clients/client-bedrock-agent-runtime/src/commands/RetrieveCommand.ts b/clients/client-bedrock-agent-runtime/src/commands/RetrieveCommand.ts index e06223c2168d..e5e3f63e6d8d 100644 --- a/clients/client-bedrock-agent-runtime/src/commands/RetrieveCommand.ts +++ b/clients/client-bedrock-agent-runtime/src/commands/RetrieveCommand.ts @@ -156,10 +156,19 @@ export interface RetrieveCommandOutput extends RetrieveResponse, __MetadataBeare * // retrievalResults: [ // KnowledgeBaseRetrievalResults // required * // { // KnowledgeBaseRetrievalResult * // content: { // RetrievalResultContent - * // text: "STRING_VALUE", // required + * // type: "TEXT" || "IMAGE" || "ROW", + * // text: "STRING_VALUE", + * // byteContent: "STRING_VALUE", + * // row: [ // RetrievalResultContentRow + * // { // RetrievalResultContentColumn + * // columnName: "STRING_VALUE", + * // columnValue: "STRING_VALUE", + * // type: "BLOB" || "BOOLEAN" || "DOUBLE" || "NULL" || "LONG" || "STRING", + * // }, + * // ], * // }, * // location: { // RetrievalResultLocation - * // type: "S3" || "WEB" || "CONFLUENCE" || "SALESFORCE" || "SHAREPOINT" || "CUSTOM", // required + * // type: "S3" || "WEB" || "CONFLUENCE" || "SALESFORCE" || "SHAREPOINT" || "CUSTOM" || "KENDRA" || "SQL", // required * // s3Location: { // RetrievalResultS3Location * // uri: "STRING_VALUE", * // }, @@ -178,6 +187,12 @@ export interface RetrieveCommandOutput extends RetrieveResponse, __MetadataBeare * // customDocumentLocation: { // RetrievalResultCustomDocumentLocation * // id: "STRING_VALUE", * // }, + * // kendraDocumentLocation: { // RetrievalResultKendraDocumentLocation + * // uri: "STRING_VALUE", + * // }, + * // sqlLocation: { // RetrievalResultSqlLocation + * // query: "STRING_VALUE", + * // }, * // }, * // score: Number("double"), * // metadata: { // RetrievalResultMetadata diff --git a/clients/client-bedrock-agent-runtime/src/commands/index.ts b/clients/client-bedrock-agent-runtime/src/commands/index.ts index 76b500f159aa..b35d1fcb2343 100644 --- a/clients/client-bedrock-agent-runtime/src/commands/index.ts +++ b/clients/client-bedrock-agent-runtime/src/commands/index.ts @@ -1,5 +1,6 @@ // smithy-typescript generated code export * from "./DeleteAgentMemoryCommand"; +export * from "./GenerateQueryCommand"; export * from "./GetAgentMemoryCommand"; export * from "./InvokeAgentCommand"; export * from "./InvokeFlowCommand"; diff --git a/clients/client-bedrock-agent-runtime/src/models/models_0.ts b/clients/client-bedrock-agent-runtime/src/models/models_0.ts index 255ba6c04df5..14a30a9bb6a2 100644 --- a/clients/client-bedrock-agent-runtime/src/models/models_0.ts +++ b/clients/client-bedrock-agent-runtime/src/models/models_0.ts @@ -2164,6 +2164,170 @@ export interface InvokeFlowResponse { responseStream: AsyncIterable | undefined; } +/** + * @public + * @enum + */ +export const InputQueryType = { + TEXT: "TEXT", +} as const; + +/** + * @public + */ +export type InputQueryType = (typeof InputQueryType)[keyof typeof InputQueryType]; + +/** + *

Contains information about a natural language query to transform into SQL.

+ * @public + */ +export interface QueryGenerationInput { + /** + *

The type of the query.

+ * @public + */ + type: InputQueryType | undefined; + + /** + *

The text of the query.

+ * @public + */ + text: string | undefined; +} + +/** + * @public + * @enum + */ +export const QueryTransformationMode = { + TEXT_TO_SQL: "TEXT_TO_SQL", +} as const; + +/** + * @public + */ +export type QueryTransformationMode = (typeof QueryTransformationMode)[keyof typeof QueryTransformationMode]; + +/** + *

Contains configurations for a knowledge base to use in transformation.

+ * @public + */ +export interface TextToSqlKnowledgeBaseConfiguration { + /** + *

The ARN of the knowledge base

+ * @public + */ + knowledgeBaseArn: string | undefined; +} + +/** + * @public + * @enum + */ +export const TextToSqlConfigurationType = { + KNOWLEDGE_BASE: "KNOWLEDGE_BASE", +} as const; + +/** + * @public + */ +export type TextToSqlConfigurationType = (typeof TextToSqlConfigurationType)[keyof typeof TextToSqlConfigurationType]; + +/** + *

Contains configurations for transforming text to SQL.

+ * @public + */ +export interface TextToSqlConfiguration { + /** + *

The type of resource to use in transformation.

+ * @public + */ + type: TextToSqlConfigurationType | undefined; + + /** + *

Specifies configurations for a knowledge base to use in transformation.

+ * @public + */ + knowledgeBaseConfiguration?: TextToSqlKnowledgeBaseConfiguration | undefined; +} + +/** + *

Contains configurations for transforming the natural language query into SQL.

+ * @public + */ +export interface TransformationConfiguration { + /** + *

The mode of the transformation.

+ * @public + */ + mode: QueryTransformationMode | undefined; + + /** + *

Specifies configurations for transforming text to SQL.

+ * @public + */ + textToSqlConfiguration?: TextToSqlConfiguration | undefined; +} + +/** + * @public + */ +export interface GenerateQueryRequest { + /** + *

Specifies information about a natural language query to transform into SQL.

+ * @public + */ + queryGenerationInput: QueryGenerationInput | undefined; + + /** + *

Specifies configurations for transforming the natural language query into SQL.

+ * @public + */ + transformationConfiguration: TransformationConfiguration | undefined; +} + +/** + * @public + * @enum + */ +export const GeneratedQueryType = { + REDSHIFT_SQL: "REDSHIFT_SQL", +} as const; + +/** + * @public + */ +export type GeneratedQueryType = (typeof GeneratedQueryType)[keyof typeof GeneratedQueryType]; + +/** + *

Contains information about a query generated for a natural language query.

+ * @public + */ +export interface GeneratedQuery { + /** + *

The type of transformed query.

+ * @public + */ + type?: GeneratedQueryType | undefined; + + /** + *

An SQL query that corresponds to the natural language query.

+ * @public + */ + sql?: string | undefined; +} + +/** + * @public + */ +export interface GenerateQueryResponse { + /** + *

A list of objects, each of which defines a generated query that can correspond to the natural language queries.

+ * @public + */ + queries?: GeneratedQuery[] | undefined; +} + /** *

A content block.

* @public @@ -2730,7 +2894,65 @@ export interface GeneratedResponsePart { } /** - *

Contains the cited text from the data source.

+ * @public + * @enum + */ +export const RetrievalResultContentColumnType = { + BLOB: "BLOB", + BOOLEAN: "BOOLEAN", + DOUBLE: "DOUBLE", + LONG: "LONG", + NULL: "NULL", + STRING: "STRING", +} as const; + +/** + * @public + */ +export type RetrievalResultContentColumnType = + (typeof RetrievalResultContentColumnType)[keyof typeof RetrievalResultContentColumnType]; + +/** + *

Contains information about a column with a cell to return in retrieval.

+ * @public + */ +export interface RetrievalResultContentColumn { + /** + *

The name of the column.

+ * @public + */ + columnName?: string | undefined; + + /** + *

The value in the column.

+ * @public + */ + columnValue?: string | undefined; + + /** + *

The data type of the value.

+ * @public + */ + type?: RetrievalResultContentColumnType | undefined; +} + +/** + * @public + * @enum + */ +export const RetrievalResultContentType = { + IMAGE: "IMAGE", + ROW: "ROW", + TEXT: "TEXT", +} as const; + +/** + * @public + */ +export type RetrievalResultContentType = (typeof RetrievalResultContentType)[keyof typeof RetrievalResultContentType]; + +/** + *

Contains information about a chunk of text from a data source in the knowledge base. If the result is from a structured data source, the cell in the database and the type of the value is also identified.

*

This data type is used in the following API operations:

*
    *
  • @@ -2749,11 +2971,29 @@ export interface GeneratedResponsePart { * @public */ export interface RetrievalResultContent { + /** + *

    The type of content in the retrieval result.

    + * @public + */ + type?: RetrievalResultContentType | undefined; + /** *

    The cited text from the data source.

    * @public */ - text: string | undefined; + text?: string | undefined; + + /** + *

    A data URI with base64-encoded content from the data source. The URI is in the following format: returned in the following format: data:image/jpeg;base64,$\{base64-encoded string\}.

    + * @public + */ + byteContent?: string | undefined; + + /** + *

    Specifies information about the rows with the cells to return in retrieval.

    + * @public + */ + row?: RetrievalResultContentColumn[] | undefined; } /** @@ -2780,6 +3020,18 @@ export interface RetrievalResultCustomDocumentLocation { id?: string | undefined; } +/** + *

    The location of a result in Amazon Kendra.

    + * @public + */ +export interface RetrievalResultKendraDocumentLocation { + /** + *

    The document's uri.

    + * @public + */ + uri?: string | undefined; +} + /** *

    The S3 data source location.

    *

    This data type is used in the following API operations:

    @@ -2831,6 +3083,18 @@ export interface RetrievalResultSharePointLocation { url?: string | undefined; } +/** + *

    Contains information about the SQL query used to retrieve the result.

    + * @public + */ +export interface RetrievalResultSqlLocation { + /** + *

    The SQL query used to retrieve the result.

    + * @public + */ + query?: string | undefined; +} + /** * @public * @enum @@ -2838,9 +3102,11 @@ export interface RetrievalResultSharePointLocation { export const RetrievalResultLocationType = { CONFLUENCE: "CONFLUENCE", CUSTOM: "CUSTOM", + KENDRA: "KENDRA", S3: "S3", SALESFORCE: "SALESFORCE", SHAREPOINT: "SHAREPOINT", + SQL: "SQL", WEB: "WEB", } as const; @@ -2876,7 +3142,7 @@ export interface RetrievalResultWebLocation { *
  • *
  • *

    - * InvokeAgent response – in the locatino field

    + * InvokeAgent response – in the location field

    *
  • *
* @public @@ -2923,6 +3189,18 @@ export interface RetrievalResultLocation { * @public */ customDocumentLocation?: RetrievalResultCustomDocumentLocation | undefined; + + /** + *

The location of a document in Amazon Kendra.

+ * @public + */ + kendraDocumentLocation?: RetrievalResultKendraDocumentLocation | undefined; + + /** + *

Specifies information about the SQL query used to retrieve the result.

+ * @public + */ + sqlLocation?: RetrievalResultSqlLocation | undefined; } /** @@ -7392,7 +7670,7 @@ export interface KnowledgeBaseQuery { */ export interface KnowledgeBaseRetrievalResult { /** - *

Contains a chunk of text from a data source in the knowledge base.

+ *

Contains information about the content of the chunk.

* @public */ content: RetrievalResultContent | undefined; @@ -8690,6 +8968,36 @@ export const InvokeFlowResponseFilterSensitiveLog = (obj: InvokeFlowResponse): a ...(obj.responseStream && { responseStream: "STREAMING_CONTENT" }), }); +/** + * @internal + */ +export const QueryGenerationInputFilterSensitiveLog = (obj: QueryGenerationInput): any => ({ + ...obj, +}); + +/** + * @internal + */ +export const GenerateQueryRequestFilterSensitiveLog = (obj: GenerateQueryRequest): any => ({ + ...obj, + ...(obj.queryGenerationInput && { queryGenerationInput: SENSITIVE_STRING }), +}); + +/** + * @internal + */ +export const GeneratedQueryFilterSensitiveLog = (obj: GeneratedQuery): any => ({ + ...obj, +}); + +/** + * @internal + */ +export const GenerateQueryResponseFilterSensitiveLog = (obj: GenerateQueryResponse): any => ({ + ...obj, + ...(obj.queries && { queries: SENSITIVE_STRING }), +}); + /** * @internal */ @@ -8815,11 +9123,19 @@ export const GeneratedResponsePartFilterSensitiveLog = (obj: GeneratedResponsePa ...(obj.textResponsePart && { textResponsePart: SENSITIVE_STRING }), }); +/** + * @internal + */ +export const RetrievalResultContentColumnFilterSensitiveLog = (obj: RetrievalResultContentColumn): any => ({ + ...obj, +}); + /** * @internal */ export const RetrievalResultContentFilterSensitiveLog = (obj: RetrievalResultContent): any => ({ ...obj, + ...(obj.row && { row: SENSITIVE_STRING }), }); /** diff --git a/clients/client-bedrock-agent-runtime/src/protocols/Aws_restJson1.ts b/clients/client-bedrock-agent-runtime/src/protocols/Aws_restJson1.ts index fbaf463eee6b..411551974423 100644 --- a/clients/client-bedrock-agent-runtime/src/protocols/Aws_restJson1.ts +++ b/clients/client-bedrock-agent-runtime/src/protocols/Aws_restJson1.ts @@ -35,6 +35,7 @@ import { } from "@smithy/types"; import { DeleteAgentMemoryCommandInput, DeleteAgentMemoryCommandOutput } from "../commands/DeleteAgentMemoryCommand"; +import { GenerateQueryCommandInput, GenerateQueryCommandOutput } from "../commands/GenerateQueryCommand"; import { GetAgentMemoryCommandInput, GetAgentMemoryCommandOutput } from "../commands/GetAgentMemoryCommand"; import { InvokeAgentCommandInput, InvokeAgentCommandOutput } from "../commands/InvokeAgentCommand"; import { InvokeFlowCommandInput, InvokeFlowCommandOutput } from "../commands/InvokeFlowCommand"; @@ -141,6 +142,7 @@ import { PromptConfiguration, PromptOverrideConfiguration, PromptTemplate, + QueryGenerationInput, QueryTransformationConfiguration, RerankDocument, RerankingConfiguration, @@ -168,9 +170,12 @@ import { StreamingConfigurations, TextInferenceConfig, TextPrompt, + TextToSqlConfiguration, + TextToSqlKnowledgeBaseConfiguration, ThrottlingException, Trace, TracePart, + TransformationConfiguration, ValidationException, VectorSearchBedrockRerankingConfiguration, VectorSearchBedrockRerankingModelConfiguration, @@ -197,6 +202,29 @@ export const se_DeleteAgentMemoryCommand = async ( return b.build(); }; +/** + * serializeAws_restJson1GenerateQueryCommand + */ +export const se_GenerateQueryCommand = async ( + input: GenerateQueryCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const b = rb(input, context); + const headers: any = { + "content-type": "application/json", + }; + b.bp("/generateQuery"); + let body: any; + body = JSON.stringify( + take(input, { + queryGenerationInput: (_) => _json(_), + transformationConfiguration: (_) => _json(_), + }) + ); + b.m("POST").h(headers).b(body); + return b.build(); +}; + /** * serializeAws_restJson1GetAgentMemoryCommand */ @@ -448,6 +476,27 @@ export const de_DeleteAgentMemoryCommand = async ( return contents; }; +/** + * deserializeAws_restJson1GenerateQueryCommand + */ +export const de_GenerateQueryCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return de_CommandError(output, context); + } + const contents: any = map({ + $metadata: deserializeMetadata(output), + }); + const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + const doc = take(data, { + queries: _json, + }); + Object.assign(contents, doc); + return contents; +}; + /** * deserializeAws_restJson1GetAgentMemoryCommand */ @@ -1855,6 +1904,8 @@ const se_PromptOverrideConfiguration = (input: PromptOverrideConfiguration, cont // se_PromptTemplate omitted. +// se_QueryGenerationInput omitted. + // se_QueryTransformationConfiguration omitted. // se_RAGStopSequences omitted. @@ -2002,6 +2053,12 @@ const se_TextInferenceConfig = (input: TextInferenceConfig, context: __SerdeCont // se_TextPrompt omitted. +// se_TextToSqlConfiguration omitted. + +// se_TextToSqlKnowledgeBaseConfiguration omitted. + +// se_TransformationConfiguration omitted. + /** * serializeAws_restJson1VectorSearchBedrockRerankingConfiguration */ @@ -2330,6 +2387,10 @@ const de_FlowTraceNodeOutputFields = (output: any, context: __SerdeContext): Flo // de_FunctionResult omitted. +// de_GeneratedQueries omitted. + +// de_GeneratedQuery omitted. + // de_GeneratedResponsePart omitted. // de_GuardrailAssessment omitted. @@ -2701,8 +2762,14 @@ const de_RerankResultsList = (output: any, context: __SerdeContext): RerankResul // de_RetrievalResultContent omitted. +// de_RetrievalResultContentColumn omitted. + +// de_RetrievalResultContentRow omitted. + // de_RetrievalResultCustomDocumentLocation omitted. +// de_RetrievalResultKendraDocumentLocation omitted. + // de_RetrievalResultLocation omitted. /** @@ -2731,6 +2798,8 @@ const de_RetrievalResultMetadataValue = (output: any, context: __SerdeContext): // de_RetrievalResultSharePointLocation omitted. +// de_RetrievalResultSqlLocation omitted. + // de_RetrievalResultWebLocation omitted. // de_RetrieveAndGenerateOutput omitted. diff --git a/codegen/sdk-codegen/aws-models/bedrock-agent-runtime.json b/codegen/sdk-codegen/aws-models/bedrock-agent-runtime.json index 1bc5b47aa40d..e494c400d640 100644 --- a/codegen/sdk-codegen/aws-models/bedrock-agent-runtime.json +++ b/codegen/sdk-codegen/aws-models/bedrock-agent-runtime.json @@ -411,6 +411,9 @@ { "target": "com.amazonaws.bedrockagentruntime#FlowResource" }, + { + "target": "com.amazonaws.bedrockagentruntime#GenerateQueryResource" + }, { "target": "com.amazonaws.bedrockagentruntime#InferenceResource" }, @@ -2921,6 +2924,140 @@ "target": "com.amazonaws.bedrockagentruntime#FunctionDefinition" } }, + "com.amazonaws.bedrockagentruntime#GenerateQuery": { + "type": "operation", + "input": { + "target": "com.amazonaws.bedrockagentruntime#GenerateQueryRequest" + }, + "output": { + "target": "com.amazonaws.bedrockagentruntime#GenerateQueryResponse" + }, + "errors": [ + { + "target": "com.amazonaws.bedrockagentruntime#AccessDeniedException" + }, + { + "target": "com.amazonaws.bedrockagentruntime#BadGatewayException" + }, + { + "target": "com.amazonaws.bedrockagentruntime#ConflictException" + }, + { + "target": "com.amazonaws.bedrockagentruntime#DependencyFailedException" + }, + { + "target": "com.amazonaws.bedrockagentruntime#InternalServerException" + }, + { + "target": "com.amazonaws.bedrockagentruntime#ResourceNotFoundException" + }, + { + "target": "com.amazonaws.bedrockagentruntime#ServiceQuotaExceededException" + }, + { + "target": "com.amazonaws.bedrockagentruntime#ThrottlingException" + }, + { + "target": "com.amazonaws.bedrockagentruntime#ValidationException" + } + ], + "traits": { + "smithy.api#documentation": "

Generates an SQL query from a natural language query. For more information, see Generate a query for structured data in the Amazon Bedrock User Guide.

", + "smithy.api#http": { + "code": 200, + "method": "POST", + "uri": "/generateQuery" + }, + "smithy.api#readonly": {} + } + }, + "com.amazonaws.bedrockagentruntime#GenerateQueryRequest": { + "type": "structure", + "members": { + "queryGenerationInput": { + "target": "com.amazonaws.bedrockagentruntime#QueryGenerationInput", + "traits": { + "smithy.api#documentation": "

Specifies information about a natural language query to transform into SQL.

", + "smithy.api#required": {} + } + }, + "transformationConfiguration": { + "target": "com.amazonaws.bedrockagentruntime#TransformationConfiguration", + "traits": { + "smithy.api#documentation": "

Specifies configurations for transforming the natural language query into SQL.

", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#input": {} + } + }, + "com.amazonaws.bedrockagentruntime#GenerateQueryResource": { + "type": "resource", + "operations": [ + { + "target": "com.amazonaws.bedrockagentruntime#GenerateQuery" + } + ] + }, + "com.amazonaws.bedrockagentruntime#GenerateQueryResponse": { + "type": "structure", + "members": { + "queries": { + "target": "com.amazonaws.bedrockagentruntime#GeneratedQueries", + "traits": { + "smithy.api#documentation": "

A list of objects, each of which defines a generated query that can correspond to the natural language queries.

" + } + } + }, + "traits": { + "smithy.api#output": {} + } + }, + "com.amazonaws.bedrockagentruntime#GeneratedQueries": { + "type": "list", + "member": { + "target": "com.amazonaws.bedrockagentruntime#GeneratedQuery" + }, + "traits": { + "smithy.api#length": { + "min": 0 + } + } + }, + "com.amazonaws.bedrockagentruntime#GeneratedQuery": { + "type": "structure", + "members": { + "type": { + "target": "com.amazonaws.bedrockagentruntime#GeneratedQueryType", + "traits": { + "smithy.api#documentation": "

The type of transformed query.

" + } + }, + "sql": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "

An SQL query that corresponds to the natural language query.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Contains information about a query generated for a natural language query.

", + "smithy.api#sensitive": {} + } + }, + "com.amazonaws.bedrockagentruntime#GeneratedQueryType": { + "type": "enum", + "members": { + "REDSHIFT_SQL": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "REDSHIFT_SQL" + } + } + } + }, "com.amazonaws.bedrockagentruntime#GeneratedResponsePart": { "type": "structure", "members": { @@ -4258,6 +4395,17 @@ "smithy.api#documentation": "

Contains information about the prompt to optimize.

" } }, + "com.amazonaws.bedrockagentruntime#InputQueryType": { + "type": "enum", + "members": { + "TEXT": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "TEXT" + } + } + } + }, "com.amazonaws.bedrockagentruntime#InputText": { "type": "string", "traits": { @@ -4886,6 +5034,15 @@ "smithy.api#documentation": "

\n Details of the knowledge base associated withe inline agent.\n

" } }, + "com.amazonaws.bedrockagentruntime#KnowledgeBaseArn": { + "type": "string", + "traits": { + "smithy.api#length": { + "max": 128 + }, + "smithy.api#pattern": "^arn:aws(|-cn|-us-gov):bedrock:[a-zA-Z0-9-]*:[0-9]{12}:knowledge-base/[0-9a-zA-Z]+$" + } + }, "com.amazonaws.bedrockagentruntime#KnowledgeBaseConfiguration": { "type": "structure", "members": { @@ -5008,7 +5165,7 @@ "content": { "target": "com.amazonaws.bedrockagentruntime#RetrievalResultContent", "traits": { - "smithy.api#documentation": "

Contains a chunk of text from a data source in the knowledge base.

", + "smithy.api#documentation": "

Contains information about the content of the chunk.

", "smithy.api#required": {} } }, @@ -6405,6 +6562,33 @@ "smithy.api#documentation": "

Contains the parameters in the request body.

" } }, + "com.amazonaws.bedrockagentruntime#QueryGenerationInput": { + "type": "structure", + "members": { + "type": { + "target": "com.amazonaws.bedrockagentruntime#InputQueryType", + "traits": { + "smithy.api#documentation": "

The type of the query.

", + "smithy.api#required": {} + } + }, + "text": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "

The text of the query.

", + "smithy.api#length": { + "min": 1, + "max": 20000 + }, + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#documentation": "

Contains information about a natural language query to transform into SQL.

", + "smithy.api#sensitive": {} + } + }, "com.amazonaws.bedrockagentruntime#QueryTransformationConfiguration": { "type": "structure", "members": { @@ -6420,6 +6604,17 @@ "smithy.api#documentation": "

To split up the prompt and retrieve multiple sources, set the transformation type to\n QUERY_DECOMPOSITION.

" } }, + "com.amazonaws.bedrockagentruntime#QueryTransformationMode": { + "type": "enum", + "members": { + "TEXT_TO_SQL": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "TEXT_TO_SQL" + } + } + } + }, "com.amazonaws.bedrockagentruntime#QueryTransformationType": { "type": "enum", "members": { @@ -7183,19 +7378,138 @@ "com.amazonaws.bedrockagentruntime#RetrievalResultContent": { "type": "structure", "members": { + "type": { + "target": "com.amazonaws.bedrockagentruntime#RetrievalResultContentType", + "traits": { + "smithy.api#documentation": "

The type of content in the retrieval result.

" + } + }, "text": { "target": "smithy.api#String", "traits": { - "smithy.api#documentation": "

The cited text from the data source.

", - "smithy.api#required": {} + "smithy.api#addedDefault": {}, + "smithy.api#default": "", + "smithy.api#documentation": "

The cited text from the data source.

" + } + }, + "byteContent": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "

A data URI with base64-encoded content from the data source. The URI is in the following format: returned in the following format: data:image/jpeg;base64,${base64-encoded string}.

" + } + }, + "row": { + "target": "com.amazonaws.bedrockagentruntime#RetrievalResultContentRow", + "traits": { + "smithy.api#documentation": "

Specifies information about the rows with the cells to return in retrieval.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Contains information about a chunk of text from a data source in the knowledge base. If the result is from a structured data source, the cell in the database and the type of the value is also identified.

\n

This data type is used in the following API operations:

\n ", + "smithy.api#sensitive": {} + } + }, + "com.amazonaws.bedrockagentruntime#RetrievalResultContentColumn": { + "type": "structure", + "members": { + "columnName": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "

The name of the column.

" + } + }, + "columnValue": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "

The value in the column.

" + } + }, + "type": { + "target": "com.amazonaws.bedrockagentruntime#RetrievalResultContentColumnType", + "traits": { + "smithy.api#documentation": "

The data type of the value.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Contains information about a column with a cell to return in retrieval.

", + "smithy.api#sensitive": {} + } + }, + "com.amazonaws.bedrockagentruntime#RetrievalResultContentColumnType": { + "type": "enum", + "members": { + "BLOB": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "BLOB" + } + }, + "BOOLEAN": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "BOOLEAN" + } + }, + "DOUBLE": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "DOUBLE" + } + }, + "NULL": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "NULL" + } + }, + "LONG": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "LONG" + } + }, + "STRING": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "STRING" } } + } + }, + "com.amazonaws.bedrockagentruntime#RetrievalResultContentRow": { + "type": "list", + "member": { + "target": "com.amazonaws.bedrockagentruntime#RetrievalResultContentColumn" }, "traits": { - "smithy.api#documentation": "

Contains the cited text from the data source.

\n

This data type is used in the following API operations:

\n ", "smithy.api#sensitive": {} } }, + "com.amazonaws.bedrockagentruntime#RetrievalResultContentType": { + "type": "enum", + "members": { + "TEXT": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "TEXT" + } + }, + "IMAGE": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "IMAGE" + } + }, + "ROW": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "ROW" + } + } + } + }, "com.amazonaws.bedrockagentruntime#RetrievalResultCustomDocumentLocation": { "type": "structure", "members": { @@ -7210,6 +7524,20 @@ "smithy.api#documentation": "

Contains information about the location of a document in a custom data source.

" } }, + "com.amazonaws.bedrockagentruntime#RetrievalResultKendraDocumentLocation": { + "type": "structure", + "members": { + "uri": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "

The document's uri.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

The location of a result in Amazon Kendra.

" + } + }, "com.amazonaws.bedrockagentruntime#RetrievalResultLocation": { "type": "structure", "members": { @@ -7255,10 +7583,22 @@ "traits": { "smithy.api#documentation": "

Specifies the location of a document in a custom data source.

" } + }, + "kendraDocumentLocation": { + "target": "com.amazonaws.bedrockagentruntime#RetrievalResultKendraDocumentLocation", + "traits": { + "smithy.api#documentation": "

The location of a document in Amazon Kendra.

" + } + }, + "sqlLocation": { + "target": "com.amazonaws.bedrockagentruntime#RetrievalResultSqlLocation", + "traits": { + "smithy.api#documentation": "

Specifies information about the SQL query used to retrieve the result.

" + } } }, "traits": { - "smithy.api#documentation": "

Contains information about the data source location.

\n

This data type is used in the following API operations:

\n ", + "smithy.api#documentation": "

Contains information about the data source location.

\n

This data type is used in the following API operations:

\n ", "smithy.api#sensitive": {} } }, @@ -7300,6 +7640,18 @@ "traits": { "smithy.api#enumValue": "CUSTOM" } + }, + "KENDRA": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "KENDRA" + } + }, + "SQL": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "SQL" + } } } }, @@ -7372,6 +7724,20 @@ "smithy.api#documentation": "

The SharePoint data source location.

" } }, + "com.amazonaws.bedrockagentruntime#RetrievalResultSqlLocation": { + "type": "structure", + "members": { + "query": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "

The SQL query used to retrieve the result.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Contains information about the SQL query used to retrieve the result.

" + } + }, "com.amazonaws.bedrockagentruntime#RetrievalResultWebLocation": { "type": "structure", "members": { @@ -8459,6 +8825,53 @@ "smithy.api#sensitive": {} } }, + "com.amazonaws.bedrockagentruntime#TextToSqlConfiguration": { + "type": "structure", + "members": { + "type": { + "target": "com.amazonaws.bedrockagentruntime#TextToSqlConfigurationType", + "traits": { + "smithy.api#documentation": "

The type of resource to use in transformation.

", + "smithy.api#required": {} + } + }, + "knowledgeBaseConfiguration": { + "target": "com.amazonaws.bedrockagentruntime#TextToSqlKnowledgeBaseConfiguration", + "traits": { + "smithy.api#documentation": "

Specifies configurations for a knowledge base to use in transformation.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Contains configurations for transforming text to SQL.

" + } + }, + "com.amazonaws.bedrockagentruntime#TextToSqlConfigurationType": { + "type": "enum", + "members": { + "KNOWLEDGE_BASE": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "KNOWLEDGE_BASE" + } + } + } + }, + "com.amazonaws.bedrockagentruntime#TextToSqlKnowledgeBaseConfiguration": { + "type": "structure", + "members": { + "knowledgeBaseArn": { + "target": "com.amazonaws.bedrockagentruntime#KnowledgeBaseArn", + "traits": { + "smithy.api#documentation": "

The ARN of the knowledge base

", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#documentation": "

Contains configurations for a knowledge base to use in transformation.

" + } + }, "com.amazonaws.bedrockagentruntime#ThrottlingException": { "type": "structure", "members": { @@ -8607,6 +9020,27 @@ "smithy.api#sensitive": {} } }, + "com.amazonaws.bedrockagentruntime#TransformationConfiguration": { + "type": "structure", + "members": { + "mode": { + "target": "com.amazonaws.bedrockagentruntime#QueryTransformationMode", + "traits": { + "smithy.api#documentation": "

The mode of the transformation.

", + "smithy.api#required": {} + } + }, + "textToSqlConfiguration": { + "target": "com.amazonaws.bedrockagentruntime#TextToSqlConfiguration", + "traits": { + "smithy.api#documentation": "

Specifies configurations for transforming text to SQL.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Contains configurations for transforming the natural language query into SQL.

" + } + }, "com.amazonaws.bedrockagentruntime#Type": { "type": "enum", "members": {