Skip to content

Commit

Permalink
feat(client-bedrock-agent): Add prompt support for chat template conf…
Browse files Browse the repository at this point in the history
…iguration and agent generative AI resource. Add support for configuring an optional guardrail in Prompt and Knowledge Base nodes in Prompt Flows. Add API to validate flow definition
  • Loading branch information
awstools committed Nov 7, 2024
1 parent 362a7bd commit 7f72a17
Show file tree
Hide file tree
Showing 31 changed files with 6,997 additions and 2,345 deletions.
8 changes: 8 additions & 0 deletions clients/client-bedrock-agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -699,3 +699,11 @@ UpdatePrompt
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock-agent/command/UpdatePromptCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-agent/Interface/UpdatePromptCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-agent/Interface/UpdatePromptCommandOutput/)

</details>
<details>
<summary>
ValidateFlowDefinition
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock-agent/command/ValidateFlowDefinitionCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-agent/Interface/ValidateFlowDefinitionCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-agent/Interface/ValidateFlowDefinitionCommandOutput/)

</details>
23 changes: 23 additions & 0 deletions clients/client-bedrock-agent/src/BedrockAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,11 @@ import {
UpdatePromptCommandInput,
UpdatePromptCommandOutput,
} from "./commands/UpdatePromptCommand";
import {
ValidateFlowDefinitionCommand,
ValidateFlowDefinitionCommandInput,
ValidateFlowDefinitionCommandOutput,
} from "./commands/ValidateFlowDefinitionCommand";

const commands = {
AssociateAgentKnowledgeBaseCommand,
Expand Down Expand Up @@ -321,6 +326,7 @@ const commands = {
UpdateFlowAliasCommand,
UpdateKnowledgeBaseCommand,
UpdatePromptCommand,
ValidateFlowDefinitionCommand,
};

export interface BedrockAgent {
Expand Down Expand Up @@ -1225,6 +1231,23 @@ export interface BedrockAgent {
options: __HttpHandlerOptions,
cb: (err: any, data?: UpdatePromptCommandOutput) => void
): void;

/**
* @see {@link ValidateFlowDefinitionCommand}
*/
validateFlowDefinition(
args: ValidateFlowDefinitionCommandInput,
options?: __HttpHandlerOptions
): Promise<ValidateFlowDefinitionCommandOutput>;
validateFlowDefinition(
args: ValidateFlowDefinitionCommandInput,
cb: (err: any, data?: ValidateFlowDefinitionCommandOutput) => void
): void;
validateFlowDefinition(
args: ValidateFlowDefinitionCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: ValidateFlowDefinitionCommandOutput) => void
): void;
}

/**
Expand Down
10 changes: 8 additions & 2 deletions clients/client-bedrock-agent/src/BedrockAgentClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ import {
UpdateKnowledgeBaseCommandOutput,
} from "./commands/UpdateKnowledgeBaseCommand";
import { UpdatePromptCommandInput, UpdatePromptCommandOutput } from "./commands/UpdatePromptCommand";
import {
ValidateFlowDefinitionCommandInput,
ValidateFlowDefinitionCommandOutput,
} from "./commands/ValidateFlowDefinitionCommand";
import {
ClientInputEndpointParameters,
ClientResolvedEndpointParameters,
Expand Down Expand Up @@ -236,7 +240,8 @@ export type ServiceInputTypes =
| UpdateFlowAliasCommandInput
| UpdateFlowCommandInput
| UpdateKnowledgeBaseCommandInput
| UpdatePromptCommandInput;
| UpdatePromptCommandInput
| ValidateFlowDefinitionCommandInput;

/**
* @public
Expand Down Expand Up @@ -303,7 +308,8 @@ export type ServiceOutputTypes =
| UpdateFlowAliasCommandOutput
| UpdateFlowCommandOutput
| UpdateKnowledgeBaseCommandOutput
| UpdatePromptCommandOutput;
| UpdatePromptCommandOutput
| ValidateFlowDefinitionCommandOutput;

/**
* @public
Expand Down
104 changes: 102 additions & 2 deletions clients/client-bedrock-agent/src/commands/CreateFlowCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ export interface CreateFlowCommandOutput extends CreateFlowResponse, __MetadataB
* knowledgeBase: { // KnowledgeBaseFlowNodeConfiguration
* knowledgeBaseId: "STRING_VALUE", // required
* modelId: "STRING_VALUE",
* guardrailConfiguration: { // GuardrailConfiguration
* guardrailIdentifier: "STRING_VALUE",
* guardrailVersion: "STRING_VALUE",
* },
* },
* condition: { // ConditionFlowNodeConfiguration
* conditions: [ // FlowConditions // required
Expand All @@ -75,7 +79,7 @@ export interface CreateFlowCommandOutput extends CreateFlowResponse, __MetadataB
* promptArn: "STRING_VALUE", // required
* },
* inline: { // PromptFlowNodeInlineConfiguration
* templateType: "TEXT", // required
* templateType: "TEXT" || "CHAT", // required
* templateConfiguration: { // PromptTemplateConfiguration Union: only one key present
* text: { // TextPromptTemplateConfiguration
* text: "STRING_VALUE", // required
Expand All @@ -85,6 +89,48 @@ export interface CreateFlowCommandOutput extends CreateFlowResponse, __MetadataB
* },
* ],
* },
* chat: { // ChatPromptTemplateConfiguration
* messages: [ // Messages // required
* { // Message
* role: "user" || "assistant", // required
* content: [ // ContentBlocks // required
* { // ContentBlock Union: only one key present
* text: "STRING_VALUE",
* },
* ],
* },
* ],
* system: [ // SystemContentBlocks
* { // SystemContentBlock Union: only one key present
* text: "STRING_VALUE",
* },
* ],
* inputVariables: [
* {
* name: "STRING_VALUE",
* },
* ],
* toolConfiguration: { // ToolConfiguration
* tools: [ // Tools // required
* { // Tool Union: only one key present
* toolSpec: { // ToolSpecification
* name: "STRING_VALUE", // required
* description: "STRING_VALUE",
* inputSchema: { // ToolInputSchema Union: only one key present
* json: "DOCUMENT_VALUE",
* },
* },
* },
* ],
* toolChoice: { // ToolChoice Union: only one key present
* auto: {},
* any: {},
* tool: { // SpecificToolChoice
* name: "STRING_VALUE", // required
* },
* },
* },
* },
* },
* modelId: "STRING_VALUE", // required
* inferenceConfiguration: { // PromptInferenceConfiguration Union: only one key present
Expand All @@ -100,6 +146,10 @@ export interface CreateFlowCommandOutput extends CreateFlowResponse, __MetadataB
* additionalModelRequestFields: "DOCUMENT_VALUE",
* },
* },
* guardrailConfiguration: {
* guardrailIdentifier: "STRING_VALUE",
* guardrailVersion: "STRING_VALUE",
* },
* },
* lambdaFunction: { // LambdaFunctionFlowNodeConfiguration
* lambdaArn: "STRING_VALUE", // required
Expand Down Expand Up @@ -186,6 +236,10 @@ export interface CreateFlowCommandOutput extends CreateFlowResponse, __MetadataB
* // knowledgeBase: { // KnowledgeBaseFlowNodeConfiguration
* // knowledgeBaseId: "STRING_VALUE", // required
* // modelId: "STRING_VALUE",
* // guardrailConfiguration: { // GuardrailConfiguration
* // guardrailIdentifier: "STRING_VALUE",
* // guardrailVersion: "STRING_VALUE",
* // },
* // },
* // condition: { // ConditionFlowNodeConfiguration
* // conditions: [ // FlowConditions // required
Expand All @@ -205,7 +259,7 @@ export interface CreateFlowCommandOutput extends CreateFlowResponse, __MetadataB
* // promptArn: "STRING_VALUE", // required
* // },
* // inline: { // PromptFlowNodeInlineConfiguration
* // templateType: "TEXT", // required
* // templateType: "TEXT" || "CHAT", // required
* // templateConfiguration: { // PromptTemplateConfiguration Union: only one key present
* // text: { // TextPromptTemplateConfiguration
* // text: "STRING_VALUE", // required
Expand All @@ -215,6 +269,48 @@ export interface CreateFlowCommandOutput extends CreateFlowResponse, __MetadataB
* // },
* // ],
* // },
* // chat: { // ChatPromptTemplateConfiguration
* // messages: [ // Messages // required
* // { // Message
* // role: "user" || "assistant", // required
* // content: [ // ContentBlocks // required
* // { // ContentBlock Union: only one key present
* // text: "STRING_VALUE",
* // },
* // ],
* // },
* // ],
* // system: [ // SystemContentBlocks
* // { // SystemContentBlock Union: only one key present
* // text: "STRING_VALUE",
* // },
* // ],
* // inputVariables: [
* // {
* // name: "STRING_VALUE",
* // },
* // ],
* // toolConfiguration: { // ToolConfiguration
* // tools: [ // Tools // required
* // { // Tool Union: only one key present
* // toolSpec: { // ToolSpecification
* // name: "STRING_VALUE", // required
* // description: "STRING_VALUE",
* // inputSchema: { // ToolInputSchema Union: only one key present
* // json: "DOCUMENT_VALUE",
* // },
* // },
* // },
* // ],
* // toolChoice: { // ToolChoice Union: only one key present
* // auto: {},
* // any: {},
* // tool: { // SpecificToolChoice
* // name: "STRING_VALUE", // required
* // },
* // },
* // },
* // },
* // },
* // modelId: "STRING_VALUE", // required
* // inferenceConfiguration: { // PromptInferenceConfiguration Union: only one key present
Expand All @@ -230,6 +326,10 @@ export interface CreateFlowCommandOutput extends CreateFlowResponse, __MetadataB
* // additionalModelRequestFields: "DOCUMENT_VALUE",
* // },
* // },
* // guardrailConfiguration: {
* // guardrailIdentifier: "STRING_VALUE",
* // guardrailVersion: "STRING_VALUE",
* // },
* // },
* // lambdaFunction: { // LambdaFunctionFlowNodeConfiguration
* // lambdaArn: "STRING_VALUE", // required
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ export interface CreateFlowVersionCommandOutput extends CreateFlowVersionRespons
* // knowledgeBase: { // KnowledgeBaseFlowNodeConfiguration
* // knowledgeBaseId: "STRING_VALUE", // required
* // modelId: "STRING_VALUE",
* // guardrailConfiguration: { // GuardrailConfiguration
* // guardrailIdentifier: "STRING_VALUE",
* // guardrailVersion: "STRING_VALUE",
* // },
* // },
* // condition: { // ConditionFlowNodeConfiguration
* // conditions: [ // FlowConditions // required
Expand All @@ -86,7 +90,7 @@ export interface CreateFlowVersionCommandOutput extends CreateFlowVersionRespons
* // promptArn: "STRING_VALUE", // required
* // },
* // inline: { // PromptFlowNodeInlineConfiguration
* // templateType: "TEXT", // required
* // templateType: "TEXT" || "CHAT", // required
* // templateConfiguration: { // PromptTemplateConfiguration Union: only one key present
* // text: { // TextPromptTemplateConfiguration
* // text: "STRING_VALUE", // required
Expand All @@ -96,6 +100,48 @@ export interface CreateFlowVersionCommandOutput extends CreateFlowVersionRespons
* // },
* // ],
* // },
* // chat: { // ChatPromptTemplateConfiguration
* // messages: [ // Messages // required
* // { // Message
* // role: "user" || "assistant", // required
* // content: [ // ContentBlocks // required
* // { // ContentBlock Union: only one key present
* // text: "STRING_VALUE",
* // },
* // ],
* // },
* // ],
* // system: [ // SystemContentBlocks
* // { // SystemContentBlock Union: only one key present
* // text: "STRING_VALUE",
* // },
* // ],
* // inputVariables: [
* // {
* // name: "STRING_VALUE",
* // },
* // ],
* // toolConfiguration: { // ToolConfiguration
* // tools: [ // Tools // required
* // { // Tool Union: only one key present
* // toolSpec: { // ToolSpecification
* // name: "STRING_VALUE", // required
* // description: "STRING_VALUE",
* // inputSchema: { // ToolInputSchema Union: only one key present
* // json: "DOCUMENT_VALUE",
* // },
* // },
* // },
* // ],
* // toolChoice: { // ToolChoice Union: only one key present
* // auto: {},
* // any: {},
* // tool: { // SpecificToolChoice
* // name: "STRING_VALUE", // required
* // },
* // },
* // },
* // },
* // },
* // modelId: "STRING_VALUE", // required
* // inferenceConfiguration: { // PromptInferenceConfiguration Union: only one key present
Expand All @@ -111,6 +157,10 @@ export interface CreateFlowVersionCommandOutput extends CreateFlowVersionRespons
* // additionalModelRequestFields: "DOCUMENT_VALUE",
* // },
* // },
* // guardrailConfiguration: {
* // guardrailIdentifier: "STRING_VALUE",
* // guardrailVersion: "STRING_VALUE",
* // },
* // },
* // lambdaFunction: { // LambdaFunctionFlowNodeConfiguration
* // lambdaArn: "STRING_VALUE", // required
Expand Down
Loading

0 comments on commit 7f72a17

Please sign in to comment.