Enhancing the Customer Service Experience with Amazon Bedrock's Guardrails
Learn to promote safe interactions within Bedrock for innovating the customer service experience.
Published Jan 24, 2024
In the fast-evolving world of AI and given the prevalence of bad actors, ensuring the safety and relevance of customer interactions has become more important than ever. Often, it has all come down to prompt engineering attempting to ensure that these inputs are handled. While it is effective in some instances, mostly it is not, given how LLMs are prone to forgetting context that was originally provided to them. Amazon Bedrock's Guardrails feature offers a robust solution to navigate this challenge effectively.
Amazon Bedrock is a fully managed platform for developing generative AI applications, starting with a foundational model (FM). Guardrails is a key feature of Amazon Bedrock that allows organizations to set up safeguards - known as guardrails - that monitor both user inputs and AI outputs, ensuring they align with company policies. These safeguards are applicable across various FMs and can be integrated with different AI applications.
There are five main steps in designing guardrails for customer service:
- Define the Guardrails: Identify the specific needs of your customer service, like topics to avoid and content to filter. For instance, blocking discussions on investment advice in a tech support chat.
- Customize Thresholds: Set thresholds for different content categories based on the level of strictness required.
- Integration with Customer Service Tools: Combine Guardrails with your existing customer service tools to streamline the process.
- Regular Monitoring and Adjustments: Regularly review the performance of Guardrails and make necessary adjustments to the configurations.
- Prepare for Future Features: Plan for upcoming features like PII redaction to further enhance the safety and privacy of customer interactions.
Now, we can start off with providing the guardrail details.
In this case, we will name it Customer_Service_Guardrails and a description.
You will then need to put in which topics are necessary to prevent discussion on.
Below are the topics that I put for my customer service agent; these can be tailored based on your use case.
Name: Financial_Advice
Definition: Discussions that involve providing guidance, recommendations, or suggestions related to managing, investing, or handling finances, investments, or assets.
Example Phrases:
- "Can you suggest some good stocks to invest in right now?"
- "What's the best way to save for retirement?"
- "Should I put my money in a high-risk investment?"
- "How can I maximize my returns on investments?"
- "Is it a good time to buy real estate?"
Name: Political_Opinions
Definition: Conversations that express views, opinions, or endorsements related to political parties, political ideologies, elections, or political figures.
Example Phrases:
- "What's your stance on the current government policies?"
- "Do you support party X or Y in the upcoming election?"
- "Can you tell me which political party is better?"
- "What do you think about the new policy introduced by the president?"
- "Should I vote for this candidate?"
Name: Medical_Advice
Definition: Providing recommendations, diagnosis, treatment options, or guidance on medical conditions, symptoms, medications, or health-related issues.
Example Phrases:
- "What should I do to treat a persistent cough?"
- "Can you recommend some medication for my headache?"
- "What are the symptoms of a specific medical condition?"
- "Is this drug effective for treating my illness?"
- "Do I need to see a doctor for this pain I'm experiencing?"
Name: Inappropriate_Content
Definition: Any discussions or references that include hate speech, discriminatory remarks, sexual content, or explicit language.
Example Phrases:
- "Why are people from X country so [discriminatory remark]?"
- "Can you tell me a dirty joke?"
- "[Use of explicit language]"
- "This service is as bad as [hate speech]."
- "Do you have any adult content or products?"
Name: Legal_Advice
Definition: Offering guidance or suggestions on legal matters, legal actions, interpretation of laws, or legal rights and responsibilities.
Example Phrases:
- "Can I sue someone for this?"
- "What are my legal rights in this situation?"
- "Is this action against the law?"
- "What should I do to file a legal complaint?"
- "Can you explain this law to me?"
We then go ahead and define the appropriate filters and their corresponding strengths. I am setting them to medium, as I want reasonably tight guardrails, but not overly so as well.
We can then set the blocked messaging for prompts and responses.
Now, we are ready to create the guardrail. Confirm the configurations you have set and create the guardrails.
And with that, the Guardrail has been created!
Now let’s test putting it into an agent. We can try adding in a message to ask for advice on stocks, and if it is working properly this request should be denied.
As we can see, the agent is now able to appropriately provide the message that we gave it to respond to queries that it detects as part of the denied topics we put in.
It’s as simple as that! Through doing this, you’ll be able to avoid issues that can happen down the line with your inclusion of the topics that should be avoided. It is hard to find the balance between restriction and freedom of speech, but this at least provides us more flexibility to move around and take care into what we do as part of our customer service.