Skip to content

Commit 7f72a17

Browse files
author
awstools
committed
feat(client-bedrock-agent): Add prompt support for chat template configuration 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
1 parent 362a7bd commit 7f72a17

31 files changed

+6997
-2345
lines changed

clients/client-bedrock-agent/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -699,3 +699,11 @@ UpdatePrompt
699699
[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/)
700700

701701
</details>
702+
<details>
703+
<summary>
704+
ValidateFlowDefinition
705+
</summary>
706+
707+
[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/)
708+
709+
</details>

clients/client-bedrock-agent/src/BedrockAgent.ts

+23
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,11 @@ import {
257257
UpdatePromptCommandInput,
258258
UpdatePromptCommandOutput,
259259
} from "./commands/UpdatePromptCommand";
260+
import {
261+
ValidateFlowDefinitionCommand,
262+
ValidateFlowDefinitionCommandInput,
263+
ValidateFlowDefinitionCommandOutput,
264+
} from "./commands/ValidateFlowDefinitionCommand";
260265

261266
const commands = {
262267
AssociateAgentKnowledgeBaseCommand,
@@ -321,6 +326,7 @@ const commands = {
321326
UpdateFlowAliasCommand,
322327
UpdateKnowledgeBaseCommand,
323328
UpdatePromptCommand,
329+
ValidateFlowDefinitionCommand,
324330
};
325331

326332
export interface BedrockAgent {
@@ -1225,6 +1231,23 @@ export interface BedrockAgent {
12251231
options: __HttpHandlerOptions,
12261232
cb: (err: any, data?: UpdatePromptCommandOutput) => void
12271233
): void;
1234+
1235+
/**
1236+
* @see {@link ValidateFlowDefinitionCommand}
1237+
*/
1238+
validateFlowDefinition(
1239+
args: ValidateFlowDefinitionCommandInput,
1240+
options?: __HttpHandlerOptions
1241+
): Promise<ValidateFlowDefinitionCommandOutput>;
1242+
validateFlowDefinition(
1243+
args: ValidateFlowDefinitionCommandInput,
1244+
cb: (err: any, data?: ValidateFlowDefinitionCommandOutput) => void
1245+
): void;
1246+
validateFlowDefinition(
1247+
args: ValidateFlowDefinitionCommandInput,
1248+
options: __HttpHandlerOptions,
1249+
cb: (err: any, data?: ValidateFlowDefinitionCommandOutput) => void
1250+
): void;
12281251
}
12291252

12301253
/**

clients/client-bedrock-agent/src/BedrockAgentClient.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ import {
160160
UpdateKnowledgeBaseCommandOutput,
161161
} from "./commands/UpdateKnowledgeBaseCommand";
162162
import { UpdatePromptCommandInput, UpdatePromptCommandOutput } from "./commands/UpdatePromptCommand";
163+
import {
164+
ValidateFlowDefinitionCommandInput,
165+
ValidateFlowDefinitionCommandOutput,
166+
} from "./commands/ValidateFlowDefinitionCommand";
163167
import {
164168
ClientInputEndpointParameters,
165169
ClientResolvedEndpointParameters,
@@ -236,7 +240,8 @@ export type ServiceInputTypes =
236240
| UpdateFlowAliasCommandInput
237241
| UpdateFlowCommandInput
238242
| UpdateKnowledgeBaseCommandInput
239-
| UpdatePromptCommandInput;
243+
| UpdatePromptCommandInput
244+
| ValidateFlowDefinitionCommandInput;
240245

241246
/**
242247
* @public
@@ -303,7 +308,8 @@ export type ServiceOutputTypes =
303308
| UpdateFlowAliasCommandOutput
304309
| UpdateFlowCommandOutput
305310
| UpdateKnowledgeBaseCommandOutput
306-
| UpdatePromptCommandOutput;
311+
| UpdatePromptCommandOutput
312+
| ValidateFlowDefinitionCommandOutput;
307313

308314
/**
309315
* @public

clients/client-bedrock-agent/src/commands/CreateFlowCommand.ts

+102-2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ export interface CreateFlowCommandOutput extends CreateFlowResponse, __MetadataB
5656
* knowledgeBase: { // KnowledgeBaseFlowNodeConfiguration
5757
* knowledgeBaseId: "STRING_VALUE", // required
5858
* modelId: "STRING_VALUE",
59+
* guardrailConfiguration: { // GuardrailConfiguration
60+
* guardrailIdentifier: "STRING_VALUE",
61+
* guardrailVersion: "STRING_VALUE",
62+
* },
5963
* },
6064
* condition: { // ConditionFlowNodeConfiguration
6165
* conditions: [ // FlowConditions // required
@@ -75,7 +79,7 @@ export interface CreateFlowCommandOutput extends CreateFlowResponse, __MetadataB
7579
* promptArn: "STRING_VALUE", // required
7680
* },
7781
* inline: { // PromptFlowNodeInlineConfiguration
78-
* templateType: "TEXT", // required
82+
* templateType: "TEXT" || "CHAT", // required
7983
* templateConfiguration: { // PromptTemplateConfiguration Union: only one key present
8084
* text: { // TextPromptTemplateConfiguration
8185
* text: "STRING_VALUE", // required
@@ -85,6 +89,48 @@ export interface CreateFlowCommandOutput extends CreateFlowResponse, __MetadataB
8589
* },
8690
* ],
8791
* },
92+
* chat: { // ChatPromptTemplateConfiguration
93+
* messages: [ // Messages // required
94+
* { // Message
95+
* role: "user" || "assistant", // required
96+
* content: [ // ContentBlocks // required
97+
* { // ContentBlock Union: only one key present
98+
* text: "STRING_VALUE",
99+
* },
100+
* ],
101+
* },
102+
* ],
103+
* system: [ // SystemContentBlocks
104+
* { // SystemContentBlock Union: only one key present
105+
* text: "STRING_VALUE",
106+
* },
107+
* ],
108+
* inputVariables: [
109+
* {
110+
* name: "STRING_VALUE",
111+
* },
112+
* ],
113+
* toolConfiguration: { // ToolConfiguration
114+
* tools: [ // Tools // required
115+
* { // Tool Union: only one key present
116+
* toolSpec: { // ToolSpecification
117+
* name: "STRING_VALUE", // required
118+
* description: "STRING_VALUE",
119+
* inputSchema: { // ToolInputSchema Union: only one key present
120+
* json: "DOCUMENT_VALUE",
121+
* },
122+
* },
123+
* },
124+
* ],
125+
* toolChoice: { // ToolChoice Union: only one key present
126+
* auto: {},
127+
* any: {},
128+
* tool: { // SpecificToolChoice
129+
* name: "STRING_VALUE", // required
130+
* },
131+
* },
132+
* },
133+
* },
88134
* },
89135
* modelId: "STRING_VALUE", // required
90136
* inferenceConfiguration: { // PromptInferenceConfiguration Union: only one key present
@@ -100,6 +146,10 @@ export interface CreateFlowCommandOutput extends CreateFlowResponse, __MetadataB
100146
* additionalModelRequestFields: "DOCUMENT_VALUE",
101147
* },
102148
* },
149+
* guardrailConfiguration: {
150+
* guardrailIdentifier: "STRING_VALUE",
151+
* guardrailVersion: "STRING_VALUE",
152+
* },
103153
* },
104154
* lambdaFunction: { // LambdaFunctionFlowNodeConfiguration
105155
* lambdaArn: "STRING_VALUE", // required
@@ -186,6 +236,10 @@ export interface CreateFlowCommandOutput extends CreateFlowResponse, __MetadataB
186236
* // knowledgeBase: { // KnowledgeBaseFlowNodeConfiguration
187237
* // knowledgeBaseId: "STRING_VALUE", // required
188238
* // modelId: "STRING_VALUE",
239+
* // guardrailConfiguration: { // GuardrailConfiguration
240+
* // guardrailIdentifier: "STRING_VALUE",
241+
* // guardrailVersion: "STRING_VALUE",
242+
* // },
189243
* // },
190244
* // condition: { // ConditionFlowNodeConfiguration
191245
* // conditions: [ // FlowConditions // required
@@ -205,7 +259,7 @@ export interface CreateFlowCommandOutput extends CreateFlowResponse, __MetadataB
205259
* // promptArn: "STRING_VALUE", // required
206260
* // },
207261
* // inline: { // PromptFlowNodeInlineConfiguration
208-
* // templateType: "TEXT", // required
262+
* // templateType: "TEXT" || "CHAT", // required
209263
* // templateConfiguration: { // PromptTemplateConfiguration Union: only one key present
210264
* // text: { // TextPromptTemplateConfiguration
211265
* // text: "STRING_VALUE", // required
@@ -215,6 +269,48 @@ export interface CreateFlowCommandOutput extends CreateFlowResponse, __MetadataB
215269
* // },
216270
* // ],
217271
* // },
272+
* // chat: { // ChatPromptTemplateConfiguration
273+
* // messages: [ // Messages // required
274+
* // { // Message
275+
* // role: "user" || "assistant", // required
276+
* // content: [ // ContentBlocks // required
277+
* // { // ContentBlock Union: only one key present
278+
* // text: "STRING_VALUE",
279+
* // },
280+
* // ],
281+
* // },
282+
* // ],
283+
* // system: [ // SystemContentBlocks
284+
* // { // SystemContentBlock Union: only one key present
285+
* // text: "STRING_VALUE",
286+
* // },
287+
* // ],
288+
* // inputVariables: [
289+
* // {
290+
* // name: "STRING_VALUE",
291+
* // },
292+
* // ],
293+
* // toolConfiguration: { // ToolConfiguration
294+
* // tools: [ // Tools // required
295+
* // { // Tool Union: only one key present
296+
* // toolSpec: { // ToolSpecification
297+
* // name: "STRING_VALUE", // required
298+
* // description: "STRING_VALUE",
299+
* // inputSchema: { // ToolInputSchema Union: only one key present
300+
* // json: "DOCUMENT_VALUE",
301+
* // },
302+
* // },
303+
* // },
304+
* // ],
305+
* // toolChoice: { // ToolChoice Union: only one key present
306+
* // auto: {},
307+
* // any: {},
308+
* // tool: { // SpecificToolChoice
309+
* // name: "STRING_VALUE", // required
310+
* // },
311+
* // },
312+
* // },
313+
* // },
218314
* // },
219315
* // modelId: "STRING_VALUE", // required
220316
* // inferenceConfiguration: { // PromptInferenceConfiguration Union: only one key present
@@ -230,6 +326,10 @@ export interface CreateFlowCommandOutput extends CreateFlowResponse, __MetadataB
230326
* // additionalModelRequestFields: "DOCUMENT_VALUE",
231327
* // },
232328
* // },
329+
* // guardrailConfiguration: {
330+
* // guardrailIdentifier: "STRING_VALUE",
331+
* // guardrailVersion: "STRING_VALUE",
332+
* // },
233333
* // },
234334
* // lambdaFunction: { // LambdaFunctionFlowNodeConfiguration
235335
* // lambdaArn: "STRING_VALUE", // required

clients/client-bedrock-agent/src/commands/CreateFlowVersionCommand.ts

+51-1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ export interface CreateFlowVersionCommandOutput extends CreateFlowVersionRespons
6767
* // knowledgeBase: { // KnowledgeBaseFlowNodeConfiguration
6868
* // knowledgeBaseId: "STRING_VALUE", // required
6969
* // modelId: "STRING_VALUE",
70+
* // guardrailConfiguration: { // GuardrailConfiguration
71+
* // guardrailIdentifier: "STRING_VALUE",
72+
* // guardrailVersion: "STRING_VALUE",
73+
* // },
7074
* // },
7175
* // condition: { // ConditionFlowNodeConfiguration
7276
* // conditions: [ // FlowConditions // required
@@ -86,7 +90,7 @@ export interface CreateFlowVersionCommandOutput extends CreateFlowVersionRespons
8690
* // promptArn: "STRING_VALUE", // required
8791
* // },
8892
* // inline: { // PromptFlowNodeInlineConfiguration
89-
* // templateType: "TEXT", // required
93+
* // templateType: "TEXT" || "CHAT", // required
9094
* // templateConfiguration: { // PromptTemplateConfiguration Union: only one key present
9195
* // text: { // TextPromptTemplateConfiguration
9296
* // text: "STRING_VALUE", // required
@@ -96,6 +100,48 @@ export interface CreateFlowVersionCommandOutput extends CreateFlowVersionRespons
96100
* // },
97101
* // ],
98102
* // },
103+
* // chat: { // ChatPromptTemplateConfiguration
104+
* // messages: [ // Messages // required
105+
* // { // Message
106+
* // role: "user" || "assistant", // required
107+
* // content: [ // ContentBlocks // required
108+
* // { // ContentBlock Union: only one key present
109+
* // text: "STRING_VALUE",
110+
* // },
111+
* // ],
112+
* // },
113+
* // ],
114+
* // system: [ // SystemContentBlocks
115+
* // { // SystemContentBlock Union: only one key present
116+
* // text: "STRING_VALUE",
117+
* // },
118+
* // ],
119+
* // inputVariables: [
120+
* // {
121+
* // name: "STRING_VALUE",
122+
* // },
123+
* // ],
124+
* // toolConfiguration: { // ToolConfiguration
125+
* // tools: [ // Tools // required
126+
* // { // Tool Union: only one key present
127+
* // toolSpec: { // ToolSpecification
128+
* // name: "STRING_VALUE", // required
129+
* // description: "STRING_VALUE",
130+
* // inputSchema: { // ToolInputSchema Union: only one key present
131+
* // json: "DOCUMENT_VALUE",
132+
* // },
133+
* // },
134+
* // },
135+
* // ],
136+
* // toolChoice: { // ToolChoice Union: only one key present
137+
* // auto: {},
138+
* // any: {},
139+
* // tool: { // SpecificToolChoice
140+
* // name: "STRING_VALUE", // required
141+
* // },
142+
* // },
143+
* // },
144+
* // },
99145
* // },
100146
* // modelId: "STRING_VALUE", // required
101147
* // inferenceConfiguration: { // PromptInferenceConfiguration Union: only one key present
@@ -111,6 +157,10 @@ export interface CreateFlowVersionCommandOutput extends CreateFlowVersionRespons
111157
* // additionalModelRequestFields: "DOCUMENT_VALUE",
112158
* // },
113159
* // },
160+
* // guardrailConfiguration: {
161+
* // guardrailIdentifier: "STRING_VALUE",
162+
* // guardrailVersion: "STRING_VALUE",
163+
* // },
114164
* // },
115165
* // lambdaFunction: { // LambdaFunctionFlowNodeConfiguration
116166
* // lambdaArn: "STRING_VALUE", // required

0 commit comments

Comments
 (0)