Testing Buddy prompts
6 Tasks
30 mins
Scenario
Pega Academy students are reporting that EnablementBuddy, a Knowledge Buddy created to assist them in learning activities, provides inconsistent answers or misinterprets questions. Your task as Buddy Manager is to improve the buddy behavior and ensure that it provides the expected answers consistently. As EnablementBuddy is deployed to live, you must first create a new version of the current Buddy so that you can improve its prompt and test it without having an impact on daily operations.
Use the following credentials to log in to the exercise system:
Role | User name | Password |
---|---|---|
Buddy Manager | BuddyManager | rules |
Your assignment consists of the following tasks:
Task 1: Create a new version of EnablementBuddy and test it
Create a new Knowledge Buddy based on EnablementBuddy, then ask it a series of questions and observe the results.
Task 2: Update the Instructions and Information variables
Edit the Buddy you created in task 1, add new prompt instructions, and adjust the advanced settings in its information variables.
Task 3: Test the new Instructions
Ask the same series of questions from Task 1 to observe the effect of the updated prompt.
Task 4: Change the format of the Instructions
Update the instructions to use a programmatic format.
Task 5: Test the new Instructions format
Ask the same series of questions from Task 1 and Task 3 to observe the effect of the new prompt format.
Challenge Walkthrough
Detailed Tasks
1 Create a new version of EnablementBuddy and test it
- On the exercise system landing page, click Pega Infinity™ to log in as Buddy Manager:
- In the Username field, enter BuddyManager
- In the Password field, enter rules
- In the navigation pane of Pega Knowledge Buddy, click Create > Knowledge Buddy.
- In the Name field, enter EnablementBuddyV2.
- In the Description field, enter New version of EnablementBuddy with updated prompt.
- Select the Copy from existing buddy checkbox.
- In the Existing buddy drop-down list, select EnablementBuddy.
- Click Submit, then click Submit again to progress to the Configure Prompt step.
- Click Save for later.
- In the lower-right corner of Pega Knowledge Buddy, click the EnablementBuddyV2 icon.
- In the Ask your question here field, enter the first of the following questions and then click Ask. Observe the result, then repeat the process with the other questions.
- How do I open an account at U+ Bank?
- What are best practices in a contact center?
- Click Close.
Note: It is important to ask a series of questions before you introduce changes to the Buddy. This not only enables you to identify potential issues early (if it does not answer correctly at this stage), but also creates a frame of reference – if the Buddy answers your questions correctly now, it should also do so after changes are applied to the prompt.
2 Update the Instructions and Information variables
- In the top right-hand corner, click Go.
- In the Instructions field, change You are a customer service representative and I would like you to answer some questions based on the CONTEXT I provide. to You are a learning assistant and I would like you to answer some questions based on the CONTEXT I provide. Do the same with In your answer do not mention you are a customer service representative.
- In the instructions field, enter:
- 12. Add a references section to your answer and show a list of references you used in this section.
- 13. Include titles and URLs in the references section.
- 14. Use bullet lists in your response where it makes it more readable.
- 15. Before responding, ensure that you have valid references. Otherwise, reply that you don't know.
- Your answer should follow this layout:
- Question
- Answer
- References
- In the Contextual data definitions table, in the SEARCHRESULTS row, click the Actions menu, and then click Edit.
- In the Response attributes drop-down list, select Title and URL.
- Select the Advanced settings checkbox.
- In the Minimum similarity score of matches field, enter 60.
Note: The minimum similarity score dictates how strict and accurate the search results should be. The lower the number, the more lenient the matching algorithm is.
- Click Submit, then Save for later.
3 Test the new Instructions
- In the lower-right corner of Pega Knowledge Buddy, click the EnablementBuddyV2 Icon.
- Click Reset.
- In the Ask your question here field, enter the questions from Task 1, step 10, one by one, then click Ask. Observe if the answers produced by EnablementBuddyV2 include the updated prompt instructions.
- How do I open an account at U+ Bank?
- What are best practices in a contact center?
- Click Close.
4 Change the format of the instructions
- In the top right-hand corner, click Go.
- In the Instructions field, replace the current instructions with this JSON format prompt:
{
"instructions": "Respond to the query based on the chunks provided.",
"rules": [
"Use only the CONTEXT you are provided with.",
"In your answer do not mention you are a customer service representative.",
"Do not refer to anyone or anything that is not part of the CONTEXT provided.",
"If you don't know the answer, just say that you don't know.",
"Never make up answers which is not in the CONTEXT provided.",
"Do not mention that you are a customer service representative in your answer.",
"Do not mention the provided context, just answer the question.",
"Add a references section to your answer and show a list of references you used in this section.",
"Include titles and URLs in the references section.",
"Use bullet lists in your response where it makes it more readable.",
"Before responding, ensure that you have valid references. Otherwise, reply that you don't know."
],
"Response layout": {
"Question": "question as you understood",
"Answer": "Answer",
"References": [
{
"Title": "Title",
"URL": "URL"
}
]
}
}
- Click Save for later.
Note: As a best practice, do not mix a code format with informal language when writing prompts.
5 Test the new Instructions format
- In the lower-right corner of Pega Knowledge Buddy, click the EnablementBuddyV2 Icon.
- Click Reset.
- In the Ask your question here field, enter the same set of questions (Task 1 step 10 and Task 3 Step 2), then click Ask.
Observe whether the answers produced by EnablementBuddyV2 are influenced by the JSON format of the prompt.
6 Verify your work
Optional: Add additional instructions to the prompt then ask questions to observe the results. You can do this in EnablementBuddyV2 if you keep the JSON format, or create a new version of EnablementBuddy and modify the default prompt. Add your own instructions or use one of the following suggestions. Keep in mind that depending on what other changes you made to the prompt, the Buddy may not be able to follow all instructions.
- Format your answer in HTML
- Format your answer in JSON.
Available in the following mission:
Want to help us improve this content?