The rewrite utterance task rephrases user utterances that are too long or have not matched well with the chatbot's NLP questions. The rewritten utterance is never visible to your chatbot users.
You need an administrator or publisher role in your team to change a task prompt.
The task contains one prompt:
-
Rewrite Utterance generates a new way of phrasing the user's question.
Prompt variables: ${userQuestion}, ${chatHistory}.
Check the top of the usage page to see if this is the primary usage and whether your changes must be published to take effect. If there is no note indicating your changes must be published, then the changes are applied immediately and will not appear in versions.
You can use automated tests to test a prompt or model against a variety of utterances and generate suggested prompt improvements.
Changes to this prompt may impact your users' experience when the chatbot is matching their questions, so you should test your changes thoroughly before you publish. In addition to automated tests, you can test the prompt by asking questions in TestBot. Questions that have been rephrased are shown in the TestBot logs as LLM Action: Changed input into: with the generated result.
You can disable rewriting utterances in TestBot to see how the chatbot would have matched the original question.
Prompt variables and requirements
The prompt uses the following prompt variables:
- ${userQuestion}: the original user utterance to rephrase.
-
${chatHistory}: the transcript of the chat so far, which can be included to add more context to the chatbot user's utterance.
You can control whether the chat history is included using the Populate ${chatHistory} field.
If you don't want to include the chat history, leave the Populate ${chatHistory} field unselected but don't delete the ${chatHistory} prompt variable.
You don't need to provide a value for these variables: they're automatically supplied when the chatbot uses the task to rephrase a question. Make sure you don't change or delete either of the prompt variables, even if you're not using the chat history.
Suggested customisations
The default prompt specifies a word limit and instructs the generative AI model to correct spelling errors. We recommend you keep this instruction, but you may like to adjust it to be more specific to your needs. Consider your existing NLP questions and the types of changes that would best help the chatbot match the rephrased utterance to the correct question:
- Add instructions to use specific spelling, terminology, tone, or cultural ways of speaking.
For example, a banking chatbot prompt may request that the rewrite should always include banking terminology like 'statement' or 'credit card'. - Add your organisation's context, such as a banking organisation or city council.
- Request that irrelevant details such as dates, email addresses, or phone numbers are excluded or replaced with a generic term that will better match your NLP questions.
For example, a banking chatbot prompt replace numeric monetary amounts with the word 'money'. - Request that specific terms are never omitted or replaced, such as product names.
- Provide specific rewriting instructions if the utterance contains a specific term or the intent of the utterance matches that term.
This technique can help provide a better match for terms relating to regulatory compliance or other highly sensitive issues. For example, if the user question contains the term 'hardship' or the intent of the utterance relates to financial hardship, provide an output of just 'hardship'.