Skip to content

Commit

Permalink
feat(client-bedrock-agent-runtime): This release introduces the abili…
Browse files Browse the repository at this point in the history
…ty 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.
  • Loading branch information
awstools committed Dec 4, 2024
1 parent ac7f368 commit 99b090b
Show file tree
Hide file tree
Showing 13 changed files with 1,155 additions and 27 deletions.
8 changes: 8 additions & 0 deletions clients/client-bedrock-agent-runtime/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/)

</details>
<details>
<summary>
GenerateQuery
</summary>

[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/)

</details>
<details>
<summary>
Expand Down
17 changes: 17 additions & 0 deletions clients/client-bedrock-agent-runtime/src/BedrockAgentRuntime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ import {
DeleteAgentMemoryCommandInput,
DeleteAgentMemoryCommandOutput,
} from "./commands/DeleteAgentMemoryCommand";
import {
GenerateQueryCommand,
GenerateQueryCommandInput,
GenerateQueryCommandOutput,
} from "./commands/GenerateQueryCommand";
import {
GetAgentMemoryCommand,
GetAgentMemoryCommandInput,
Expand Down Expand Up @@ -40,6 +45,7 @@ import { RetrieveCommand, RetrieveCommandInput, RetrieveCommandOutput } from "./

const commands = {
DeleteAgentMemoryCommand,
GenerateQueryCommand,
GetAgentMemoryCommand,
InvokeAgentCommand,
InvokeFlowCommand,
Expand Down Expand Up @@ -69,6 +75,17 @@ export interface BedrockAgentRuntime {
cb: (err: any, data?: DeleteAgentMemoryCommandOutput) => void
): void;

/**
* @see {@link GenerateQueryCommand}
*/
generateQuery(args: GenerateQueryCommandInput, options?: __HttpHandlerOptions): Promise<GenerateQueryCommandOutput>;
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}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -91,6 +92,7 @@ export { __Client };
*/
export type ServiceInputTypes =
| DeleteAgentMemoryCommandInput
| GenerateQueryCommandInput
| GetAgentMemoryCommandInput
| InvokeAgentCommandInput
| InvokeFlowCommandInput
Expand All @@ -106,6 +108,7 @@ export type ServiceInputTypes =
*/
export type ServiceOutputTypes =
| DeleteAgentMemoryCommandOutput
| GenerateQueryCommandOutput
| GetAgentMemoryCommandOutput
| InvokeAgentCommandOutput
| InvokeFlowCommandOutput
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {}

/**
* <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>
* @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)
* <p>The request is denied because of missing access permissions. Check your permissions and retry your request.</p>
*
* @throws {@link BadGatewayException} (server fault)
* <p>There was an issue with a dependency due to a server issue. Retry your request.</p>
*
* @throws {@link ConflictException} (client fault)
* <p>There was a conflict performing an operation. Resolve the conflict and retry your request.</p>
*
* @throws {@link DependencyFailedException} (client fault)
* <p>There was an issue with a dependency. Check the resource configurations and retry the request.</p>
*
* @throws {@link InternalServerException} (server fault)
* <p>An internal server error occurred. Retry your request.</p>
*
* @throws {@link ResourceNotFoundException} (client fault)
* <p>The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.</p>
*
* @throws {@link ServiceQuotaExceededException} (client fault)
* <p>The number of requests exceeds the service quota. Resubmit your request later.</p>
*
* @throws {@link ThrottlingException} (client fault)
* <p>The number of requests exceeds the limit. Resubmit your request later.</p>
*
* @throws {@link ValidationException} (client fault)
* <p>Input validation failed. Check your request parameters and retry the request.</p>
*
* @throws {@link BedrockAgentRuntimeServiceException}
* <p>Base exception class for all service exceptions from BedrockAgentRuntime service.</p>
*
* @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;
};
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -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",
* // },
Expand All @@ -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
* // "<keys>": "DOCUMENT_VALUE",
Expand Down Expand Up @@ -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",
* // },
Expand All @@ -632,6 +656,12 @@ export interface InvokeAgentCommandOutput extends InvokeAgentResponse, __Metadat
* // customDocumentLocation: {
* // id: "STRING_VALUE",
* // },
* // kendraDocumentLocation: {
* // uri: "STRING_VALUE",
* // },
* // sqlLocation: {
* // query: "STRING_VALUE",
* // },
* // },
* // metadata: {
* // "<keys>": "DOCUMENT_VALUE",
Expand Down Expand Up @@ -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",
* // },
Expand All @@ -880,6 +919,12 @@ export interface InvokeAgentCommandOutput extends InvokeAgentResponse, __Metadat
* // customDocumentLocation: {
* // id: "STRING_VALUE",
* // },
* // kendraDocumentLocation: {
* // uri: "STRING_VALUE",
* // },
* // sqlLocation: {
* // query: "STRING_VALUE",
* // },
* // },
* // metadata: {
* // "<keys>": "DOCUMENT_VALUE",
Expand Down
Loading

0 comments on commit 99b090b

Please sign in to comment.