Skip to main content

Testing Buddy prompts

6 Tasks

30 mins

Visible to: All users
Beginner
Pega Knowledge Buddy 24.2
Pega Knowledge 24.2
English

Scenario

Note: This challenge assumes that you have completed the previous challenges in the Pega Knowledge Buddy mission and shares the practice environment with those. It is recommended that you complete them if you have not done so already.

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.

Note: While the process has been simplified for the purposes of this challenge, improving prompts is an iterative process, and a prompt often requires multiple adjustments before it offers satisfactory results. Test your adjustments multiple times with questions that previously returned correct answers. Ensure that only users who are experienced with generative AI prompt writing make changes to prompt instructions.

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.

 

You must initiate your own Pega instance to complete this Challenge.

Initialization may take up to 5 minutes so please be patient.

Challenge Walkthrough

Detailed Tasks

1 Create a new version of EnablementBuddy and test it

  1. On the exercise system landing page, click Pega Infinity™ to log in as Buddy Manager:
    1. In the Username field, enter BuddyManager
    2. In the Password field, enter rules
  2. In the navigation pane of Pega Knowledge Buddy, click Create > Knowledge Buddy.
  3. In the Name field, enter EnablementBuddyV2.
  4. In the Description field, enter New version of EnablementBuddy with updated prompt.
  5. Select the Copy from existing buddy checkbox.
  6. In the Existing buddy drop-down list, select EnablementBuddy.
create knowledge buddy dialog box
  1. Click Submit, then click Submit again to progress to the Configure Prompt step.
  2. Click Save for later.
  3. In the lower-right corner of Pega Knowledge Buddy, click the EnablementBuddyV2 icon.
The EnablementBuddyV2 icon
  1. 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.
    1. How do I open an account at U+ Bank?
    2. What are best practices in a contact center?
  2. 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

  1. In the top right-hand corner, click Go.
the GO button
  1. 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.
  2. 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
  3. In the Contextual data definitions table, in the SEARCHRESULTS row, click the Actions menu, and then click Edit.
the contextual data definitions of enablementbuddy v2
  1. In the Response attributes drop-down list, select Title and URL.
  2. Select the Advanced settings checkbox.
  3. 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.
the edit contextual data definition dialog box

 

  1. Click Submit, then Save for later.

3 Test the new Instructions

  1. In the lower-right corner of Pega Knowledge Buddy, click the EnablementBuddyV2 Icon.
  2. Click Reset.
  3. 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?
  4. Click Close.

4 Change the format of the instructions

  1. In the top right-hand corner, click Go.
  2. 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"

}

]

}

}

  1. 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

  1. In the lower-right corner of Pega Knowledge Buddy, click the EnablementBuddyV2 Icon.
  2. Click Reset.
  3. 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.

  1. Format your answer in HTML
  2. Format your answer in JSON.


Available in the following mission:

If you are having problems with your training, please review the Pega Academy Support FAQs.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Academy has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice