Provide custom rules (prompts) for your assistant
Overview
Prompts give you control over the AI Assistant tone and behavior with natural language instructions. We often refer to prompts that follow an If
-> Then
format as Rules, which we find a useful way to structure prompts.
You can use Rules to customize:
- Tone: Use a specific tone throughout the conversation.
- Structure and Style: Format answers with a certain style or structure.
- Length of Answers: Prescribe how short or long assistant messages should be.
- Conversation Flow: Customize the conversation flow, like being more conversational.
- Ask clarifying questions: For when you'd like the AI assistant to ask the user clarifying questions on certain topics.
We include examples below for common scenarios that can be good starting points for your own prompts.
By default, Inkeep assistants already minimize hallucinations, cite sources, include guard rails to protect your brand, and have other behaviors we've found to work well for "question answer" support scenarios. When developing your own prompts, we recommend trying the assistant out-of-the-box and identifying specific behaviors you'd like to see that aren't already included.
Where to configure
Dashboard
To control the AI Assistant across all integrations of a project:
- Open the Inkeep Dashboard
- Navigate to your Project under Projects.
- Choose the Settings tab.
- Select the Rules section.
- Add guidance in the
Label
,If
, andThen
structure as described in this guide. - Click on Update
- You can see the effects by testing the AI assistant under AI CHAT > Sandbox.
UI Widgets
If you prefer to customize the guidance on a per-integration basis, you can configure the aiChatSettings.prompts property of the @inkeep/cxkit-react
components.
You can structure the prompts as XML that follow the below structure:
Adding prompts in the UI components can be helpful when the behavior of the assistant should be dynamic, like when incorporated inside of your application and should vary based on user-specific properties or custom application logic. Otherwise, we recommend using the Inkeep dashboard.
API
In the inkeep-qa
API, you can provide rules as one or more system-level messages.
Prompting LLMs
When creating a rule, we recommend breaking down your instructions into an Label, If, and Then format. This mindset helps structure your instructions in a way that LLMs are more likely to "listen" to.
- Label: A succinct summary of the rule you're applying.
- If: A brief description of when your rule should be applied, usually as a condition or scenario. If you want it to always be applied, use
At All Times
. - Then: The action or behavior that should occur when the condition is met.
If
and Then
statements can be:
- Short: Succinct and to the point. Ideal for tones and speech patterns that are common and easy to understand.
- Long: Best for complex instructions or when extra context is needed. In these cases, we recommend using structured Markdown with Examples.
Example Guidance
General Tips
- Use Assertive and Direct Language: Employ clear and concise wording to increase the likelihood that the AI will follow your instructions.
- Be Specific and Unambiguous: Write instructions that are detailed and leave no room for interpretation. If a human might misunderstand your instructions, an LLM likely will too.
- Include Examples: Provide brief examples of both correct (good) and incorrect (bad) outputs to common scenarios relevant to a given rule.
- Use Exclamations and Bold Text for Emphasis: Highlight important phrases and words by incorporating exclamation points and applying bold formatting.
- Be careful with XML Tags: XML Tags can be powerful tools to structure and organize your prompts. However, if you use them, ensure they are properly closed. Use Markdown to start, and XML if your instructions get lengthy or list-like.
- Don't Be Afraid to Explain Reasoning: Within your action, you can explain your reasoning for how the examples were chosen and how the rule was applied. This helps the LLM understand your intent.
- Test Thoroughly: Create diverse test cases that capture your scenarios and verify the AI Assistant behaves consistently across all of them.
- Increase Level of Detail Gradually: Start with concise rules, but be prepared to use longer and more prescriptive
If
andThen
statements as you test your prompts.
Paste the content of this file into Anthropic's Claude or ChatGPT, and ask it to help you improve and iterate your prompt based on the guidance and examples in this document.
Conclusion
Custom Guidance can help customize your AI assistant to your liking. If you need help, reach out to prompting@inkeep.com.