Skip to content

Commit 0e347c4

Browse files
author
awstools
committed
feat(client-bedrock): Automated Reasoning checks in Amazon Bedrock Guardrails now automatically generate Q&A tests for new Automated Reasoning policies. The GetAutomatedReasoningPolicyBuildWorkflowResultAssets API adds GENERATED_TEST_CASES asset type, allowing customers to retrieve tests generated by the build workflow.
1 parent c44cfad commit 0e347c4

File tree

5 files changed

+198
-44
lines changed

5 files changed

+198
-44
lines changed

clients/client-bedrock/src/commands/GetAutomatedReasoningPolicyBuildWorkflowResultAssetsCommand.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export interface GetAutomatedReasoningPolicyBuildWorkflowResultAssetsCommandOutp
4545
* const input = { // GetAutomatedReasoningPolicyBuildWorkflowResultAssetsRequest
4646
* policyArn: "STRING_VALUE", // required
4747
* buildWorkflowId: "STRING_VALUE", // required
48-
* assetType: "BUILD_LOG" || "QUALITY_REPORT" || "POLICY_DEFINITION", // required
48+
* assetType: "BUILD_LOG" || "QUALITY_REPORT" || "POLICY_DEFINITION" || "GENERATED_TEST_CASES", // required
4949
* };
5050
* const command = new GetAutomatedReasoningPolicyBuildWorkflowResultAssetsCommand(input);
5151
* const response = await client.send(command);
@@ -268,6 +268,15 @@ export interface GetAutomatedReasoningPolicyBuildWorkflowResultAssetsCommandOutp
268268
* // },
269269
* // ],
270270
* // },
271+
* // generatedTestCases: { // AutomatedReasoningPolicyGeneratedTestCases
272+
* // generatedTestCases: [ // AutomatedReasoningPolicyGeneratedTestCaseList // required
273+
* // { // AutomatedReasoningPolicyGeneratedTestCase
274+
* // queryContent: "STRING_VALUE", // required
275+
* // guardContent: "STRING_VALUE", // required
276+
* // expectedAggregatedFindingsResult: "VALID" || "INVALID" || "SATISFIABLE" || "IMPOSSIBLE" || "TRANSLATION_AMBIGUOUS" || "TOO_COMPLEX" || "NO_TRANSLATION", // required
277+
* // },
278+
* // ],
279+
* // },
271280
* // },
272281
* // };
273282
*

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

Lines changed: 56 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1712,6 +1712,7 @@ export interface GetAutomatedReasoningPolicyBuildWorkflowResponse {
17121712
*/
17131713
export const AutomatedReasoningPolicyBuildResultAssetType = {
17141714
BUILD_LOG: "BUILD_LOG",
1715+
GENERATED_TEST_CASES: "GENERATED_TEST_CASES",
17151716
POLICY_DEFINITION: "POLICY_DEFINITION",
17161717
QUALITY_REPORT: "QUALITY_REPORT",
17171718
} as const;
@@ -2297,6 +2298,42 @@ export interface AutomatedReasoningPolicyBuildLog {
22972298
entries: AutomatedReasoningPolicyBuildLogEntry[] | undefined;
22982299
}
22992300

2301+
/**
2302+
* <p>Represents a generated test case, consisting of query content, guard content, and expected results.</p>
2303+
* @public
2304+
*/
2305+
export interface AutomatedReasoningPolicyGeneratedTestCase {
2306+
/**
2307+
* <p>The input query or prompt that generated the content. This provides context for the validation.</p>
2308+
* @public
2309+
*/
2310+
queryContent: string | undefined;
2311+
2312+
/**
2313+
* <p>The output content that's validated by the Automated Reasoning policy. This represents the foundation model response that will be checked for accuracy.</p>
2314+
* @public
2315+
*/
2316+
guardContent: string | undefined;
2317+
2318+
/**
2319+
* <p>The expected results of the generated test case. Possible values include:</p> <ul> <li> <p> <code>VALID</code> - The claims are true. The claims are implied by the premises and the Automated Reasoning policy. Given the Automated Reasoning policy and premises, it is not possible for these claims to be false. In other words, there are no alternative answers that are true that contradict the claims.</p> </li> <li> <p> <code>INVALID</code> - The claims are false. The claims are not implied by the premises and Automated Reasoning policy. Furthermore, there exists different claims that are consistent with the premises and Automated Reasoning policy.</p> </li> <li> <p> <code>SATISFIABLE</code> - The claims can be true or false. It depends on what assumptions are made for the claim to be implied from the premises and Automated Reasoning policy rules. In this situation, different assumptions can make input claims false and alternative claims true.</p> </li> <li> <p> <code>IMPOSSIBLE</code> - Automated Reasoning can’t make a statement about the claims. This can happen if the premises are logically incorrect, or if there is a conflict within the Automated Reasoning policy itself.</p> </li> </ul>
2320+
* @public
2321+
*/
2322+
expectedAggregatedFindingsResult: AutomatedReasoningCheckResult | undefined;
2323+
}
2324+
2325+
/**
2326+
* <p>Contains a comprehensive test suite generated by the build workflow, providing validation capabilities for automated reasoning policies.</p>
2327+
* @public
2328+
*/
2329+
export interface AutomatedReasoningPolicyGeneratedTestCases {
2330+
/**
2331+
* <p>Represents a collection of generated test cases.</p>
2332+
* @public
2333+
*/
2334+
generatedTestCases: AutomatedReasoningPolicyGeneratedTestCase[] | undefined;
2335+
}
2336+
23002337
/**
23012338
* <p>Represents a set of rules that operate on completely separate variables, indicating they address different concerns or domains within the policy.</p>
23022339
* @public
@@ -2388,11 +2425,12 @@ export interface AutomatedReasoningPolicyDefinitionQualityReport {
23882425
}
23892426

23902427
/**
2391-
* <p>Contains the various assets generated during a policy build workflow, including logs, quality reports, and the final policy definition.</p>
2428+
* <p>Contains the various assets generated during a policy build workflow, including logs, quality reports, test cases, and the final policy definition.</p>
23922429
* @public
23932430
*/
23942431
export type AutomatedReasoningPolicyBuildResultAssets =
23952432
| AutomatedReasoningPolicyBuildResultAssets.BuildLogMember
2433+
| AutomatedReasoningPolicyBuildResultAssets.GeneratedTestCasesMember
23962434
| AutomatedReasoningPolicyBuildResultAssets.PolicyDefinitionMember
23972435
| AutomatedReasoningPolicyBuildResultAssets.QualityReportMember
23982436
| AutomatedReasoningPolicyBuildResultAssets.$UnknownMember;
@@ -2409,6 +2447,7 @@ export namespace AutomatedReasoningPolicyBuildResultAssets {
24092447
policyDefinition: AutomatedReasoningPolicyDefinition;
24102448
qualityReport?: never;
24112449
buildLog?: never;
2450+
generatedTestCases?: never;
24122451
$unknown?: never;
24132452
}
24142453

@@ -2420,6 +2459,7 @@ export namespace AutomatedReasoningPolicyBuildResultAssets {
24202459
policyDefinition?: never;
24212460
qualityReport: AutomatedReasoningPolicyDefinitionQualityReport;
24222461
buildLog?: never;
2462+
generatedTestCases?: never;
24232463
$unknown?: never;
24242464
}
24252465

@@ -2431,6 +2471,19 @@ export namespace AutomatedReasoningPolicyBuildResultAssets {
24312471
policyDefinition?: never;
24322472
qualityReport?: never;
24332473
buildLog: AutomatedReasoningPolicyBuildLog;
2474+
generatedTestCases?: never;
2475+
$unknown?: never;
2476+
}
2477+
2478+
/**
2479+
* <p>A comprehensive test suite generated by the build workflow, providing validation capabilities for automated reasoning policies.</p>
2480+
* @public
2481+
*/
2482+
export interface GeneratedTestCasesMember {
2483+
policyDefinition?: never;
2484+
qualityReport?: never;
2485+
buildLog?: never;
2486+
generatedTestCases: AutomatedReasoningPolicyGeneratedTestCases;
24342487
$unknown?: never;
24352488
}
24362489

@@ -2441,6 +2494,7 @@ export namespace AutomatedReasoningPolicyBuildResultAssets {
24412494
policyDefinition?: never;
24422495
qualityReport?: never;
24432496
buildLog?: never;
2497+
generatedTestCases?: never;
24442498
$unknown: [string, any];
24452499
}
24462500

@@ -2452,6 +2506,7 @@ export namespace AutomatedReasoningPolicyBuildResultAssets {
24522506
policyDefinition: (value: AutomatedReasoningPolicyDefinition) => T;
24532507
qualityReport: (value: AutomatedReasoningPolicyDefinitionQualityReport) => T;
24542508
buildLog: (value: AutomatedReasoningPolicyBuildLog) => T;
2509+
generatedTestCases: (value: AutomatedReasoningPolicyGeneratedTestCases) => T;
24552510
_: (name: string, value: any) => T;
24562511
}
24572512
}
@@ -7409,35 +7464,3 @@ export interface GuardrailTopicConfig {
74097464
*/
74107465
outputEnabled?: boolean | undefined;
74117466
}
7412-
7413-
/**
7414-
* <p>Contains details about topics that the guardrail should identify and deny.</p>
7415-
* @public
7416-
*/
7417-
export interface GuardrailTopicPolicyConfig {
7418-
/**
7419-
* <p>A list of policies related to topics that the guardrail should deny.</p>
7420-
* @public
7421-
*/
7422-
topicsConfig: GuardrailTopicConfig[] | undefined;
7423-
7424-
/**
7425-
* <p>The tier that your guardrail uses for denied topic filters.</p>
7426-
* @public
7427-
*/
7428-
tierConfig?: GuardrailTopicsTierConfig | undefined;
7429-
}
7430-
7431-
/**
7432-
* @public
7433-
* @enum
7434-
*/
7435-
export const GuardrailWordAction = {
7436-
BLOCK: "BLOCK",
7437-
NONE: "NONE",
7438-
} as const;
7439-
7440-
/**
7441-
* @public
7442-
*/
7443-
export type GuardrailWordAction = (typeof GuardrailWordAction)[keyof typeof GuardrailWordAction];

0 commit comments

Comments
 (0)