Skip to content

Commit b624d0d

Browse files
author
awstools
committed
feat(client-bedrock-agent): This release adds support for using Guardrails with Bedrock Agents.
1 parent 04288c5 commit b624d0d

File tree

9 files changed

+176
-8
lines changed

9 files changed

+176
-8
lines changed

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

+8
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ export interface CreateAgentCommandOutput extends CreateAgentResponse, __Metadat
9595
* ],
9696
* overrideLambda: "STRING_VALUE",
9797
* },
98+
* guardrailConfiguration: { // GuardrailConfiguration
99+
* guardrailIdentifier: "STRING_VALUE",
100+
* guardrailVersion: "STRING_VALUE",
101+
* },
98102
* };
99103
* const command = new CreateAgentCommand(input);
100104
* const response = await client.send(command);
@@ -142,6 +146,10 @@ export interface CreateAgentCommandOutput extends CreateAgentResponse, __Metadat
142146
* // ],
143147
* // overrideLambda: "STRING_VALUE",
144148
* // },
149+
* // guardrailConfiguration: { // GuardrailConfiguration
150+
* // guardrailIdentifier: "STRING_VALUE",
151+
* // guardrailVersion: "STRING_VALUE",
152+
* // },
145153
* // },
146154
* // };
147155
*

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

+4
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ export interface GetAgentCommandOutput extends GetAgentResponse, __MetadataBeare
8383
* // ],
8484
* // overrideLambda: "STRING_VALUE",
8585
* // },
86+
* // guardrailConfiguration: { // GuardrailConfiguration
87+
* // guardrailIdentifier: "STRING_VALUE",
88+
* // guardrailVersion: "STRING_VALUE",
89+
* // },
8690
* // },
8791
* // };
8892
*

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

+4
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ export interface GetAgentVersionCommandOutput extends GetAgentVersionResponse, _
8686
* // ],
8787
* // overrideLambda: "STRING_VALUE",
8888
* // },
89+
* // guardrailConfiguration: { // GuardrailConfiguration
90+
* // guardrailIdentifier: "STRING_VALUE",
91+
* // guardrailVersion: "STRING_VALUE",
92+
* // },
8993
* // },
9094
* // };
9195
*

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

+4
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ export interface ListAgentVersionsCommandOutput extends ListAgentVersionsRespons
5050
* // createdAt: new Date("TIMESTAMP"), // required
5151
* // updatedAt: new Date("TIMESTAMP"), // required
5252
* // description: "STRING_VALUE",
53+
* // guardrailConfiguration: { // GuardrailConfiguration
54+
* // guardrailIdentifier: "STRING_VALUE",
55+
* // guardrailVersion: "STRING_VALUE",
56+
* // },
5357
* // },
5458
* // ],
5559
* // nextToken: "STRING_VALUE",

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

+4
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ export interface ListAgentsCommandOutput extends ListAgentsResponse, __MetadataB
4949
* // description: "STRING_VALUE",
5050
* // updatedAt: new Date("TIMESTAMP"), // required
5151
* // latestAgentVersion: "STRING_VALUE",
52+
* // guardrailConfiguration: { // GuardrailConfiguration
53+
* // guardrailIdentifier: "STRING_VALUE",
54+
* // guardrailVersion: "STRING_VALUE",
55+
* // },
5256
* // },
5357
* // ],
5458
* // nextToken: "STRING_VALUE",

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

+8
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ export interface UpdateAgentCommandOutput extends UpdateAgentResponse, __Metadat
6969
* ],
7070
* overrideLambda: "STRING_VALUE",
7171
* },
72+
* guardrailConfiguration: { // GuardrailConfiguration
73+
* guardrailIdentifier: "STRING_VALUE",
74+
* guardrailVersion: "STRING_VALUE",
75+
* },
7276
* };
7377
* const command = new UpdateAgentCommand(input);
7478
* const response = await client.send(command);
@@ -116,6 +120,10 @@ export interface UpdateAgentCommandOutput extends UpdateAgentResponse, __Metadat
116120
* // ],
117121
* // overrideLambda: "STRING_VALUE",
118122
* // },
123+
* // guardrailConfiguration: { // GuardrailConfiguration
124+
* // guardrailIdentifier: "STRING_VALUE",
125+
* // guardrailVersion: "STRING_VALUE",
126+
* // },
119127
* // },
120128
* // };
121129
*

clients/client-bedrock-agent/src/models/models_0.ts

+56-2
Original file line numberDiff line numberDiff line change
@@ -933,6 +933,24 @@ export const AgentStatus = {
933933
*/
934934
export type AgentStatus = (typeof AgentStatus)[keyof typeof AgentStatus];
935935

936+
/**
937+
* <p>The details of the guardrails configuration.</p>
938+
* @public
939+
*/
940+
export interface GuardrailConfiguration {
941+
/**
942+
* <p>The guardrails identifier assigned to the guardrails configuration.</p>
943+
* @public
944+
*/
945+
guardrailIdentifier?: string;
946+
947+
/**
948+
* <p>The guardrails version assigned to the guardrails configuration.</p>
949+
* @public
950+
*/
951+
guardrailVersion?: string;
952+
}
953+
936954
/**
937955
* <p>Contains inference parameters to use when the agent invokes a foundation model in the part of the agent sequence defined by the <code>promptType</code>. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html">Inference parameters for foundation models</a>.</p>
938956
* @public
@@ -1059,7 +1077,7 @@ export interface PromptConfiguration {
10591077
promptState?: PromptState;
10601078

10611079
/**
1062-
* <p>Defines the prompt template with which to replace the default prompt template. You can use placeholder variables in the base prompt template to customize the prompt. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-placeholders.html">Prompt template placeholder variables</a>.</p>
1080+
* <p>Defines the prompt template with which to replace the default prompt template. You can use placeholder variables in the base prompt template to customize the prompt. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-placeholders.html">Prompt template placeholder variables</a>. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/advanced-prompts-configure.html">Configure the prompt templates</a>.</p>
10631081
* @public
10641082
*/
10651083
basePromptTemplate?: string;
@@ -1089,7 +1107,7 @@ export interface PromptOverrideConfiguration {
10891107
promptConfigurations: PromptConfiguration[] | undefined;
10901108

10911109
/**
1092-
* <p>The ARN of the Lambda function to use when parsing the raw foundation model output in parts of the agent sequence. If you specify this field, at least one of the <code>promptConfigurations</code> must contain a <code>parserMode</code> value that is set to <code>OVERRIDDEN</code>.</p>
1110+
* <p>The ARN of the Lambda function to use when parsing the raw foundation model output in parts of the agent sequence. If you specify this field, at least one of the <code>promptConfigurations</code> must contain a <code>parserMode</code> value that is set to <code>OVERRIDDEN</code>. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/lambda-parser.html">Parser Lambda function in Agents for Amazon Bedrock</a>.</p>
10931111
* @public
10941112
*/
10951113
overrideLambda?: string;
@@ -1232,6 +1250,12 @@ export interface Agent {
12321250
* @public
12331251
*/
12341252
promptOverrideConfiguration?: PromptOverrideConfiguration;
1253+
1254+
/**
1255+
* <p>The guardrails configuration assigned to the agent.</p>
1256+
* @public
1257+
*/
1258+
guardrailConfiguration?: GuardrailConfiguration;
12351259
}
12361260

12371261
/**
@@ -1594,6 +1618,12 @@ export interface CreateAgentRequest {
15941618
* @public
15951619
*/
15961620
promptOverrideConfiguration?: PromptOverrideConfiguration;
1621+
1622+
/**
1623+
* <p>The unique Guardrail configuration assigned to the agent when it is created.</p>
1624+
* @public
1625+
*/
1626+
guardrailConfiguration?: GuardrailConfiguration;
15971627
}
15981628

15991629
/**
@@ -1720,6 +1750,12 @@ export interface AgentSummary {
17201750
* @public
17211751
*/
17221752
latestAgentVersion?: string;
1753+
1754+
/**
1755+
* <p>The details of the guardrails configuration in the agent summary.</p>
1756+
* @public
1757+
*/
1758+
guardrailConfiguration?: GuardrailConfiguration;
17231759
}
17241760

17251761
/**
@@ -1837,6 +1873,12 @@ export interface UpdateAgentRequest {
18371873
* @public
18381874
*/
18391875
promptOverrideConfiguration?: PromptOverrideConfiguration;
1876+
1877+
/**
1878+
* <p>The unique Guardrail configuration assigned to the agent when it is updated.</p>
1879+
* @public
1880+
*/
1881+
guardrailConfiguration?: GuardrailConfiguration;
18401882
}
18411883

18421884
/**
@@ -1951,6 +1993,12 @@ export interface AgentVersion {
19511993
* @public
19521994
*/
19531995
promptOverrideConfiguration?: PromptOverrideConfiguration;
1996+
1997+
/**
1998+
* <p>The guardrails configuration assigned to the agent version.</p>
1999+
* @public
2000+
*/
2001+
guardrailConfiguration?: GuardrailConfiguration;
19542002
}
19552003

19562004
/**
@@ -1993,6 +2041,12 @@ export interface AgentVersionSummary {
19932041
* @public
19942042
*/
19952043
description?: string;
2044+
2045+
/**
2046+
* <p>The details of the guardrails configuration in the agent version summary.</p>
2047+
* @public
2048+
*/
2049+
guardrailConfiguration?: GuardrailConfiguration;
19962050
}
19972051

19982052
/**

clients/client-bedrock-agent/src/protocols/Aws_restJson1.ts

+11
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ import {
138138
FixedSizeChunkingConfiguration,
139139
Function,
140140
FunctionSchema,
141+
GuardrailConfiguration,
141142
InferenceConfiguration,
142143
IngestionJob,
143144
IngestionJobFilter,
@@ -219,6 +220,7 @@ export const se_CreateAgentCommand = async (
219220
customerEncryptionKeyArn: [],
220221
description: [],
221222
foundationModel: [],
223+
guardrailConfiguration: (_) => _json(_),
222224
idleSessionTTLInSeconds: [],
223225
instruction: [],
224226
promptOverrideConfiguration: (_) => se_PromptOverrideConfiguration(_, context),
@@ -927,6 +929,7 @@ export const se_UpdateAgentCommand = async (
927929
customerEncryptionKeyArn: [],
928930
description: [],
929931
foundationModel: [],
932+
guardrailConfiguration: (_) => _json(_),
930933
idleSessionTTLInSeconds: [],
931934
instruction: [],
932935
promptOverrideConfiguration: (_) => se_PromptOverrideConfiguration(_, context),
@@ -2112,6 +2115,8 @@ const de_ValidationExceptionRes = async (parsedOutput: any, context: __SerdeCont
21122115

21132116
// se_FunctionSchema omitted.
21142117

2118+
// se_GuardrailConfiguration omitted.
2119+
21152120
/**
21162121
* serializeAws_restJson1InferenceConfiguration
21172122
*/
@@ -2256,6 +2261,7 @@ const de_Agent = (output: any, context: __SerdeContext): Agent => {
22562261
description: __expectString,
22572262
failureReasons: _json,
22582263
foundationModel: __expectString,
2264+
guardrailConfiguration: _json,
22592265
idleSessionTTLInSeconds: __expectInt32,
22602266
instruction: __expectString,
22612267
preparedAt: (_: any) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)),
@@ -2420,6 +2426,7 @@ const de_AgentSummary = (output: any, context: __SerdeContext): AgentSummary =>
24202426
agentName: __expectString,
24212427
agentStatus: __expectString,
24222428
description: __expectString,
2429+
guardrailConfiguration: _json,
24232430
latestAgentVersion: __expectString,
24242431
updatedAt: (_: any) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)),
24252432
}) as any;
@@ -2440,6 +2447,7 @@ const de_AgentVersion = (output: any, context: __SerdeContext): AgentVersion =>
24402447
description: __expectString,
24412448
failureReasons: _json,
24422449
foundationModel: __expectString,
2450+
guardrailConfiguration: _json,
24432451
idleSessionTTLInSeconds: __expectInt32,
24442452
instruction: __expectString,
24452453
promptOverrideConfiguration: (_: any) => de_PromptOverrideConfiguration(_, context),
@@ -2471,6 +2479,7 @@ const de_AgentVersionSummary = (output: any, context: __SerdeContext): AgentVers
24712479
agentVersion: __expectString,
24722480
createdAt: (_: any) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)),
24732481
description: __expectString,
2482+
guardrailConfiguration: _json,
24742483
updatedAt: (_: any) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)),
24752484
}) as any;
24762485
};
@@ -2537,6 +2546,8 @@ const de_DataSourceSummary = (output: any, context: __SerdeContext): DataSourceS
25372546

25382547
// de_FunctionSchema omitted.
25392548

2549+
// de_GuardrailConfiguration omitted.
2550+
25402551
/**
25412552
* deserializeAws_restJson1InferenceConfiguration
25422553
*/

0 commit comments

Comments
 (0)