You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
addition of Amazon Bedrock Guardrail support for the case summarization (#267)
* addition of Amazon Bedrock Guardrail support for the case summarization
* restructure and minor fixes
* Update case-summarization/README.md
---------
Co-authored-by: Samuel CHNIBER <[email protected]>
Co-authored-by: Iakov GAN <[email protected]>
Co-authored-by: Iakov Gan <[email protected]>
Amazon Bedrock Guardrail is a crucial security feature for generative AI applications that helps implement safeguards based on specific use cases and responsible AI policies. It provides an additional layer of protection on top of the native safeguards offered by foundation models (FMs)[1][2].
3
+
4
+
## Key Features and Importance
5
+
6
+
Amazon Bedrock Guardrails offers several important security features:
7
+
8
+
1.**Content Filtering**: It helps block harmful content by evaluating both user inputs and model responses. The system can filter out content related to hate speech, insults, sexual content, violence, and misconduct[2].
9
+
10
+
2.**Topic Restrictions**: Organizations can define specific topics to avoid, ensuring that interactions remain relevant to their business and align with company policies[2].
11
+
12
+
3.**Sensitive Information Protection**: The system can detect and redact personally identifiable information (PII) in user inputs and model responses, helping to protect user privacy[2][3].
13
+
14
+
4.**Custom Word Filtering**: It allows the configuration of custom words or phrases to be blocked, including profanity or specific terms like competitor names[2].
15
+
16
+
5.**Hallucination Detection**: Contextual grounding checks help detect and filter out hallucinations in model responses, ensuring more accurate and trustworthy information[2].
17
+
18
+
## Security Importance
19
+
20
+
The importance of Amazon Bedrock Guardrails for security cannot be overstated:
21
+
22
+
1.**Enhanced Content Safety**: It can block up to 85% more harmful content compared to native FM protections, significantly improving the safety of AI applications[2].
23
+
24
+
2.**Consistent Security Across Models**: Guardrails work with all large language models in Amazon Bedrock, providing a uniform level of security regardless of the underlying model[2].
25
+
26
+
3.**Customizable Safeguards**: Organizations can create multiple guardrails with different configurations, tailoring security measures to specific applications and use cases[1][3].
27
+
28
+
4.**Compliance and Responsible AI**: By allowing fine-tuned control over content and interactions, Guardrails help organizations adhere to their responsible AI policies and maintain regulatory compliance[2].
29
+
30
+
5.**Protection Against Prompt Attacks**: The system safeguards against prompt injection and jailbreak attempts, enhancing overall security[2].
31
+
32
+
Amazon Bedrock Guardrails plays a vital role in ensuring that generative AI applications remain safe, relevant, and aligned with organizational policies. By providing robust, customizable security features, it enables businesses to leverage the power of AI while mitigating potential risks associated with harmful or inappropriate content[1][2][3].
33
+
34
+
### Reasonable Defaults
35
+
36
+
This plugin comes with the following reasonable defaults that can be overriden through the parameters exposed by the CloudFormation template:
37
+
38
+
| Parameter | Description | Default |
39
+
| --- | --- | --- |
40
+
| BlockedInputMessage | Message to return when the Amazon Bedrock Guardrail blocks a prompt. | {"executive_summary":"Amazon Bedrock Guardrails has blocked the AWS Support Case Summarization.","proposed_solutions":"","actions":"","references":[],"tam_involved":"","feedback":""} |
41
+
| BlockedOutputMessage | Message to return when the Amazon Bedrock Guardrail blocks a model response | '' |
42
+
| IncludeSexualContentFilter | Whether to include Sexual Content Filter in the Guardrail or not | 'yes' |
43
+
| SexualContentFilterInputStrength | The strength of the content filter to apply to prompts. As you increase the filter strength, the likelihood of filtering harmful content increases and the probability of seeing harmful content in your application reduces. | 'HIGH' |
44
+
| SexualContentFilterOutputStrength | The strength of the content filter to apply to model responses. As you increase the filter strength, the likelihood of filtering harmful content increases and the probability of seeing harmful content in your application reduces | 'HIGH' |
45
+
| IncludeViolentContentFilter | Whether to include Violent Content Filter in the Guardrail or not | 'yes' |
46
+
| ViolentContentFilterInputStrength | The strength of the content filter to apply to prompts. As you increase the filter strength, the likelihood of filtering harmful content increases and the probability of seeing harmful content in your application reduces | 'HIGH' |
47
+
| ViolentContentFilterOutputStrength | The strength of the content filter to apply to model responses. As you increase the filter strength, the likelihood of filtering harmful content increases and the probability of seeing harmful content in your application reduces | 'HIGH' |
48
+
| IncludeHateContentFilter | Whether to include Violent Content Filter in the Guardrail or not | 'yes' |
49
+
| HateContentFilterInputStrength | The strength of the content filter to apply to prompts. As you increase the filter strength, the likelihood of filtering harmful content increases and the probability of seeing harmful content in your application reduces | 'HIGH' |
50
+
| HateContentFilterOutputStrength | The strength of the content filter to apply to prompts. As you increase the filter strength, the likelihood of filtering harmful content increases and the probability of seeing harmful content in your application reduces | 'HIGH' |
51
+
| IncludeInsultsContentFilter | Whether to include Insults Content Filter in the Guardrail or not | 'yes' |
52
+
| InsultsContentFilterInputStrength | The strength of the content filter to apply to prompts. As you increase the filter strength, the likelihood of filtering harmful content increases and the probability of seeing harmful content in your application reduces | 'HIGH' |
53
+
| InsultsContentFilterOutputStrength | The strength of the content filter to apply to prompts. As you increase the filter strength, the likelihood of filtering harmful content increases and the probability of seeing harmful content in your application reduces | 'HIGH' |
54
+
| IncludeMisconductContentFilter | Whether to include Insults Content Filter in the Guardrail or not | 'yes' |
55
+
| MisconductContentFilterInputStrength | The strength of the content filter to apply to prompts. As you increase the filter strength, the likelihood of filtering harmful content increases and the probability of seeing harmful content in your application reduces | 'HIGH' |
56
+
| MisconductContentFilterOutputStrength | The strength of the content filter to apply to prompts. As you increase the filter strength, the likelihood of filtering harmful content increases and the probability of seeing harmful content in your application reduces | 'HIGH' |
57
+
| IncludePromptAttackContentFilter | Whether to include Insults Content Filter in the Guardrail or not | 'yes' |
58
+
| PromptAttackContentFilterInputStrength | The strength of the content filter to apply to prompts. As you increase the filter strength, the likelihood of filtering harmful content increases and the probability of seeing harmful content in your application reduces | 'HIGH' |
59
+
60
+
### References & Further reading
61
+
62
+
*[1] How Amazon Bedrock Guardrails works https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails-how.html
63
+
*[2] Generative AI Data Governance - Amazon Bedrock Guardrails - AWS https://aws.amazon.com/bedrock/guardrails/
64
+
*[3] Stop harmful content in models using Amazon Bedrock Guardrails https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails.html
65
+
66
+
## Usage
67
+
68
+
This stack will deploy a minimalistic Amazon Bedrock Guardrail that will filter out any inputs or outputs that can be assimilated to prompt hacking, sexual, violent, misconduct, hatred speech or insults. Any additional fine-tuning of filters can be acheived by customizing this template.
69
+
70
+
## Support and Contribution
71
+
72
+
See [CONTRIBUTING](../../../CONTRIBUTING.md) for more information.
73
+
74
+
## Security
75
+
76
+
See [SECURITY](../../../SECURITY.md) for more information.
77
+
78
+
## License
79
+
80
+
This project is licensed under the Apache-2.0 License.
System: You are an expert technical writer specializing in creating concise, neutral summaries of AWS customers support interactions. Your task is to summarize conversations between customers and AWS Support, maintaining objectivity and clarity. Here is the Conversation to be summarized:
if guardrail_identifier == '' or guardrail_version == '':
295
+
logger.info("support case summarization isn't using any Amazon Bedrock Guardrail Configuration.")
296
+
llm = Bedrock(
297
+
model=model_id,
298
+
region_name=REGION,
299
+
temperature=float(TEMPERATURE),
300
+
max_tokens=int(MAX_TOKENS),
301
+
max_retries=int(MAX_RETRIES),
302
+
timeout=float(TIMEOUT)
303
+
)
304
+
elif guardrail_identifier != '' and guardrail_version != '':
305
+
logger.info(f"support case summarization is using Amazon Bedrock Guardrail id: {guardrail_identifier} (Version {guardrail_version}) with tracing {trace}")
306
+
llm = Bedrock(
307
+
model=model_id,
308
+
region_name=REGION,
309
+
temperature=float(TEMPERATURE),
310
+
max_tokens=int(MAX_TOKENS),
311
+
max_retries=int(MAX_RETRIES),
312
+
timeout=float(TIMEOUT),
313
+
guardrail_identifier=guardrail_identifier,
314
+
guardrail_version=guardrail_version,
315
+
trace=trace
316
+
)
317
+
273
318
return LLMTextCompletionProgram.from_defaults(
274
319
llm=llm,
275
320
output_cls=Summary,
@@ -313,8 +358,9 @@ Resources:
313
358
314
359
logger.info("support case summarization starting")
0 commit comments