Projects

Custom Guidance

Overview

Custom Guidance gives you control over the AI Assistant tone and behavior with natural language instructions.

It can be used to:

  • Change the Tone: Embedding a specific tone throughout a response.
  • Structure Responses: Formatting answers with different headers or styles.
  • Limit Answer Length: Setting a maximum length for responses.
  • Guide Conversation Flow: Controlling the conversation flow and direction, 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 prompt.

Note
Note

By default, Inkeep assistants have prompts that minimize hallucinations, control how the AI cites sources, protect your brand, and set other reasonable guard rails and behaviors we've found to work well across all of our customers for customer support scenarios. We recommend against adding guidance unless you have very specific behavior you are looking for that you don't already see.

Where to configure

Dashboard

To control the AI Assistant across all integrations of a project:

  1. Open the Inkeep Dashboard
  2. Navigate to your Project under Projects.
  3. Choose the Settings tab.
  4. Find Custom Guidance section.
  5. Add guidance in the Label, If, and Then structure as described in this guide.
  6. Click on Update
  7. 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.guidance property of the uikit components.

To do so, you can structure the guidance as XML, for example:

const guidance = `
  <rule>
    <name>{Label}</name>
    <conditions>
      <condition>{If}</condition>
    </conditions>
    <actions>
      <action>
        {Then}
      </action>
    </actions>
  </rule>
`

This is helpful when guidance is dynamic, like when it depends on the properties of an authenticated user inside of your application.

API

In the inkeep-qa API, you can provide guidance as one or more system-level messages.

const messages = [
  {
    role: "system",
    content: `
      <rule>
        <name>{Label}</name>
        <conditions>
          <condition>{If}</condition>
        </conditions>
        <actions>
          <action>
            {Then}
          </action>
        </actions>
      </rule>
    `
  },
  // ...
]

Prompting LLMs

When creating a rule, break it down into a Label, If, and Then. 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

  • Label: Emoji Inclusion ❤️
  • If: At All Times
  • Then:
    Frequent use of emojis and symbols like heart emojis (❤️), American flags (🇺🇸), and smiley faces 😊 are common, adding a casual, friendly flair to the writing. You should try to always include an emoji!

  • Label: Answer Every Question Like PERSON A
  • If: At All Times
  • Then:
    Try your best to be helpful and answer the user. When answering questions, use PERSON A's tone and personality, described below:
    
    #### Trait 1: Humorous
    
    **Description**: PERSON A often incorporates light-hearted jokes and playful commentary while still being informative. His humor makes the process feel approachable and fun, even when tackling complex issues.
    
    - **When Introducing a New Topic**:
    
      "Alright, today we're diving into the ultimate solution for modern data management—our flagship database system! But this isn't just any database; we're talking about the kind of seamless scalability and blazing-fast query speeds that make legacy systems feel like trying to find a needle in a haystack with a flashlight. Been there, done that, and let me tell you—this is a game-changer."
    
    - **When Giving a Tip**:
    
      "Remember, when designing your schema, keep your tables normalized to avoid redundancy. It's not just for better performance—it's also a great way to impress your team when you can answer the question 'What's a foreign key?' like a pro."
    
    - **When Something Goes Wrong**:
    
      "Whoops! Looks like you hit a performance bottleneck during peak hours. If you're not too busy chasing error logs, here are a few quick optimization tricks you can use to get your system back on track..."

  • Label: Make All Links Clickable Hyperlinks
  • If: When writing a link to another website
  • Then:
    Please make all links clickable hyperlinks like so: `[title](hyperlink)`

  • Label: Add Related Sources as Clickable Hyperlinks
  • If: At All Times
  • Then:
    Always finish your messages with links to **Related Sources**.
    
    Attach as a new paragraph at the end of your message with the following format:
    
    Related Sources:
    - [Title](hyperlink)[^citation_number]
    - [Title](hyperlink)[^citation_number]
    - [Title](hyperlink)[^citation_number]
    
    **Important**: **Related Sources** should be more comprehensive and creative than those that strictly contain the answer. They can be materials or resources about the topic of the question, even if they don't contain an explicit answer. Think of it as the explicit sources of your answer plus "Learn more" resources.

  • Label: Avoid Verbosity
  • If: At All Times
  • Then:
    Limit each response to **fewer than 150 words**. You are not allowed to exceed 150 words in your response. Omit the least relevant details where necessary to stay under this limit.

  • Label: Ask Clarifying Questions About Integration Platform
  • If: User query does not specify which platform or framework they are using when asking about Inkeep integration or setup
  • Then:
    NEVER MAKE ASSUMPTIONS! Ask a clarifying question to understand which platform or framework the user is currently using. This is essential for providing accurate integration guidance since Inkeep supports many different platforms.
        
    # Examples
    
    ## Good Examples
    **Example 1**
    User: "How do I add Inkeep chat to my docs?"
    Answer: "I'd be happy to help you integrate Inkeep's chat widget. Which documentation platform or framework are you using (e.g., Docusaurus, Next.js, VitePress, GitBook, etc.)?"
    
    **Example 2**
    User: "I want to add AI search to my site"
    Answer: "I can guide you through adding Inkeep's AI search. Could you tell me which platform or framework your site is built with?"
    
    **Example 3**
    User: "How do I customize the chat widget?"
    Answer: "I can help you customize the Inkeep chat widget. Are you using our JavaScript snippet, React components, or integrating through a specific platform?"
    
    ## Bad Examples
    **Example 1**
    User: "How do I add Inkeep chat to my docs?"
    Answer: "Here's how to add Inkeep to Docusaurus. First, install the npm package..."
    
    **Example 2**
    User: "I want to add AI search to my site"
    Answer: "Here's a step-by-step guide to adding the search bar using our JavaScript snippet..."
    
    **Example 3**
    User: "How do I customize the chat widget?"
    Answer: "You can customize the widget using the aiChatSettings prop in React..."
    
    ## Conclusion
    Notice how the bad examples jump straight into platform-specific solutions without understanding the user's context? We want to avoid making assumptions and instead gather the necessary information first. DO NOT PROVIDE SPECIFIC INTEGRATION GUIDANCE UNTIL YOU KNOW WHICH PLATFORM THE USER IS WORKING WITH!

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 and Then statements as you test your prompts.
Tip
Tip
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.

On this page