Applying best practices to prompt writing
As a prompt manager, after you write a prompt for a Pega GenAI™ Knowledge Buddy, you must test it, gather and analyze feedback, and then adjust the prompt instructions. Repeat this process as many times as needed until the Knowledge Buddy delivers the outcome you desire consistently.
Video
Transcript
In this video, you learn how to apply best practices for writing prompts to an already existing set of instructions so you can improve the performance of the Knowledge Buddy that uses them.
Note that while the video shows Knowledge Buddy, what is shown here is not the default Knowledge Buddy prompt and has undergone modification to facilitate this demonstration. Furthermore, the best practices displayed during this video are generally applicable, but always confirm whether your organization has a specific set of best practices to apply when you write prompts. Focus on the instructions field and explore the ways that you can improve the prompt.
First, always provide correct, clear, and specific instructions. You can correct the grammar of the first rule provided and the same for the one regarding numbered lists.
Next, you can place the two rules that reference the Knowledge Buddy answering as a CSR one after another. Grouping similar rules makes instructions more easily readable. You can also slightly modify the wording of the second sentence to make it clearer.
"Be as descriptive as possible" directly contradicts the first rule, which instructs the Knowledge Buddy to be as precise as possible. To avoid confusing the Knowledge Buddy, remove the line entirely.
Avoiding hallucinations is crucial in making sure that the generative AI provides correct answers. You can add a number of rules that make it clear to the Buddy that it should only work with the context that you provide, then group all rules that reference the CONTEXT together.
The rule "If you don't know the answer, just say that you don't know." ensures that the Knowledge Buddy has instructions on what to do in a situation in which it cannot provide an answer. This measure is also important in preventing it from hallucinating an answer.
The next rule instructs the Knowledge Buddy in HTML format to bold "special terms." While you can use either informal or programmatic language to write prompts, you should only use one or the other within one set of instructions to maintain consistency. Replace that sentence with "Bold any special terms."
Numbered or bulleted lists can greatly improve readability, and you can apply this advice to the Knowledge Buddy instructions as well.
Lastly, it is important to make sure that the Knowledge Buddy only provides valid references, but you should also provide the Knowledge Buddy with instructions on how to proceed in a situation in which it does not have valid references.
Let us compare the revised prompt with the original one, side by side.
To summarize, you have corrected grammar, removed conflict, and grouped similar rules. You provided instructions that safeguard against hallucinations, replaced programmatic language, improved readability with a numbered list, and provided guidance when the Knowledge Buddy cannot supply valid references.
Your next steps now are to test the new set of instructions, verify if the answers produced by the Knowledge Buddy are satisfactory, and then iterate on the process as many times as needed.
You have reached the end of this video.
This Topic is available in the following Module:
Want to help us improve this content?