Skip to content

Commit 12d5a8f

Browse files
authored
docs(conversation-design): Adds guidelines for LLM guardrails. (#4920)
* Updates conversation design guidelines. * docs(conversation-design): Adds guidelines for LLM guardrails.
1 parent c51df5b commit 12d5a8f

File tree

1 file changed

+39
-19
lines changed

1 file changed

+39
-19
lines changed

packages/documentation-site/patternfly-docs/content/AI/conversation-design/conversation-design.md

Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ section: AI
66
import { Button, Flex, FlexItem } from '@patternfly/react-core';
77
import ArrowRightIcon from '@patternfly/react-icons/dist/esm/icons/arrow-right-icon';
88

9-
109
# Conversation design guidelines
1110

1211
**Conversation design** is a method of writing for conversational interfaces, like chatbots or voicebots. The goal of conversation design is to create an interactive experience that resembles human-to-human conversation as much as possible. Like traditional content design, conversation design is focused on using words to make experiences clear, concise, and well-timed.
@@ -25,34 +24,25 @@ Following these best practices to help ensure that your users can complete their
2524
- If you ask for personal info, tell users "why" you're asking first.
2625
- Always have the last word.
2726

28-
## Writing for chatbots
29-
30-
When chatbots are designed to meet the needs of your users, they can improve the overall UX of your product. They are convenient, efficient, and persistent.
27+
## Chatbot conversation design
3128

32-
[Our chatbot extension](/extensions/chatbot/overview) utilizes PatternFly components to create a foundation for an AI-based chatbot, with additional customization options.
29+
Chatbots provide users with persistent access to convenient help. When they are intentionally designed to meet the needs of your users, chatbots can improve your users' efficiency and enhance the overall UX of your product.
3330

34-
<Flex>
35-
<FlexItem>
36-
<Button component="a" href="/extensions/chatbot/overview" target="_blank" variant="primary" size="lg">Use the chatbot extension <ArrowRightIcon /></Button>
37-
</FlexItem>
38-
</Flex>
31+
Chatbots are only as good as the writing that goes into them. The language they use must build trust, clearly establish the “rules” of the conversation, and support users' goals. General microcopy, like headings or buttons, should match PatternFly's standard [content design guidelines](/content-design/overview), but there are additional guidelines to follow for common message types and conversation patterns.
3932

40-
Chatbots are only as good as the writing that goes into them. The language they use must build trust, clearly establish the “rules” of the conversation, and support users' goals.
33+
[Our ChatBot extension](/extensions/chatbot/overview) utilizes PatternFly components to create a foundation for a customizable AI-based chatbot. When using ChatBot, it's important to adhere to the following conversation design guidelines.
4134

42-
In addition to general microcopy, like headings or buttons, you will need to write:
43-
- Welcome and goodbye messages.
44-
- Bot prompts.
45-
- AI disclosures.
35+
### Writing messages
4636

47-
### Welcome and goodbye messages
37+
#### Welcome and goodbye messages
4838

49-
It is important to always welcome users to the chatbot experience, and (if applicable) to say goodbye when they've ended the chat. A goodbye message isn't always necessary, like in instances where users can "minimize" a chat window to come back to it later.
39+
Always welcome users to a conversation with your ChatBot. If there's an "end" to a conversation, make sure to also say goodbye to your users. In instances where users can "minimize" a chat window to come back to it later, a goodbye message isn't necessary.
5040

5141
When you know your user's name, address them directly.
5242

5343
![Chatbot welcome message with user's name](./img/chatbot-welcome.png)
5444

55-
### Bot prompts
45+
#### Bot prompts
5646

5747
When writing your bot's prompts:
5848

@@ -66,10 +56,40 @@ When writing your bot's prompts:
6656

6757
![Chatbot prompt examples](./img/chatbot-prompts.png)
6858

69-
### AI disclosure
59+
### Conversation design patterns
60+
61+
#### Disclosing AI usage
7062

7163
Make sure to disclose any use of AI in chatbots. Our users should be able to trust that we are honest and transparent with them as much as possible.
7264

7365
- Use labels and other visual styling cues to clearly identify AI features.
7466
- Add necessary legal disclosures where you can, like in the chatbot footer.
7567
- Display an indicator when the bot is "thinking" or "typing," so that users know to expect feedback.
68+
69+
#### Handling unsafe or unethical requests
70+
71+
LLM guardrails are safety mechanisms that moderate how a model handles sensitive or risky prompts. [Research shows](https://arxiv.org/html/2506.00195v1) that a user's experience is shaped more by how a model handles a refusal than by their initial intent. Even if you cannot fulfill a user's request, it is important to handle the interaction tactfully to ensure they feel respected.
72+
73+
Many models default to providing direct or explanation-based refusals (such as "I can’t do that" or "I can’t assist because of a safety policy"), but these can be perceived as frustrating or patronizing. While users generally prefer that a model fully complies with their requests, safety and policy requirements often make this impossible. When a guardrail is triggered, your goal is to instead "let them down easy" to maintain trust and engagement.
74+
75+
When a user requests something unsafe or unethical, follow these core strategies:
76+
77+
- **Prioritize partial compliance:** Whenever possible, answer the general or theoretical parts of a user's request without providing actionable, dangerous, or sensitive details.
78+
- **Explain the refusal:** To reinforce transparency, clearly explain why action cannot be taken to fully comply with a user's request.
79+
- **Redirect instead of shutting down:** Avoid using definitive phrases like "I refuse" or "I cannot." Instead, suggest a related, safer topic to keep the conversation productive.
80+
81+
| Strategy | Usage | Example |
82+
| :---: | :---: | :---: |
83+
| **Partial compliance** | Use by default when intent is ambiguous and fulfilling a request would compromise compliance, safety, or ethical rules. | "The process of [Topic] generally involves [General principle]..." |
84+
| **Explanation** | Use when refusing a specific request to reinforce transparency and trust. | "To ensure user privacy, I don't have access to individual [Data type]..." |
85+
| **Redirection** | Use when a specific request cannot be fulfilled and partial compliance has either already been attempted or is not possible. | "I can’t provide specifics on that, but I can suggest some resources on [Related topic]." |
86+
87+
##### Message streaming considerations
88+
89+
Real-time message streaming introduces unique technical challenges because guardrails must be checked dynamically as text is generated. To maintain a seamless experience, you should gracefully handle guardrail triggers at different stages of the conversation.
90+
91+
If a guardrail prevents a model response from ever being generated, provide a clear system-level message in the UI so the user isn't left waiting for a response that will never arrive. For example, this might look something like: "I'm sorry, I'm not able to assist with that request for safety reasons. Is there something else I can help you with?"
92+
93+
More complex are situations where violations are detected mid-stream. In these cases, avoid simply deleting the message from the DOM or UI, as disappearing content is likely to confuse users. Instead, if a guardrail is triggered while a message is streaming, replace the partial response with a standard refusal or redirection message.
94+
95+
To balance safety with timely streaming, consider a "chunk-based" verification workflow, as outlined in this [AWS article about guardrails](https://aws.amazon.com/blogs/machine-learning/build-safe-and-responsible-generative-ai-applications-with-guardrails/). Instead of waiting to validate the LLM's entire response once it's generated, you can validate its reply in small segments, only displaying a content in the UI after it has been verified. This approach creates a buffer that ensures safety without sacrificing the "real-time" feel of the conversation. If a segment fails, you can halt the stream and redirect to a safer topic or address inability to reply.

0 commit comments

Comments
 (0)