Prompt Engineering
Overview
A prompt is simply a word or series of words that initiate a response from an AI. Anything input by the user is considered a prompt.
Prompts play a pivotal role in the functionality of generative AI, acting as the fundamental channel of communication between the user and the AI. At their most basic, prompts are designed to direct the AI’s generation of specific outputs or execution of tasks.
Any prompt will elicit a response, however, to elicit an effective response, the user must provide specific details required by the AI relevant to the request. A poor prompt, that is, a generic request that fails to provide the required information, will still yield a response, however the quality of the response will be much worse than the response generated by a comprehensive and well thought out prompt.
To develop a well thought out and comprehensive prompt the user needs to be cognizant of:
- The needs of the AI
- A granular understanding of the task being requested.
To guide the user in understanding the requirements of the AI, we have adapted 3 prompting templates. These templates will guide the user in providing the minimum amount of detail for the AI to provide an effective response. These templates include:
When users are comfortable with prompting using these templates, or if they are looking for more comprehensive answers to more complex questions, they may move on to different prompting strategies. These strategies are less about understanding the needs of the AI and are more about deconstructing the user task so more comprehensive prompts and higher quality responses may be generated. There are four categories of strategies. These are:
Each category will have multiple strategies progressing from basic approaches through intermediate and on to advanced approaches.
Prompt Engineering – Templates TOCD
Prompt Template Patters
Prompts play a pivotal role in the functionality of generative AI, acting as the fundamental channel of communication between the user and the AI. They are designed to direct the AI’s generation of specific outputs or execution of tasks. Any prompt will elicit a response, however, to elicit an effective response, the user must provide specific details required by the AI relevant to the request. Prompting templates can help the user in preparing effective prompts that include the detail required by the AI. This prompting template was adapted from the insights of Yi Zhou (2023).
TOCD Prompt Template Patterns
This template is simple and efficient, yielding clear results. This is a good first start for working with AI. This template focuses more on identifying the specific task components required by the AI and communicating them in detail. TOCD is an acronym which outlines the component parts of the template:
Each of these component parts possess a variety of attributes.
Template Component | Relevant Attributes | Example |
---|---|---|
Task | Role Command Topic | Psychology InstructorCreate a quiz on Jungian ArchetypesCarl Jung |
Output | Format Structure Qualities Content Dos and Don’ts | Multiple Choice5 questionsOne correct and three distractors4 answers for each questionIndicate the correct answer |
Context | Perspective Goal Target Audience | Instructor assessing knowledgeAssess knowledge of Jungian ArchetypesUndergraduate University Students |
Data | User Data Examples | Undergraduate students studying foundational psychology theory.1964 book “Man and His Symbols” |
Implementation
Consider the components of the template and the relevant attributes. Each attribute identified in the above table may not be required to adequately describe the template component for the AI to provide an effective response. Conversely, additional relevant attributes not identified in the table may be included in the users’ prompt.
Example
Should the user determine that the most relevant attributes are as follows:
Then these can be combined into the following prompt as indicated below.
Prompt Template
“Act as a [role] with [behaviour] performs [task] ensures [structure]. Remember [Specifications/Constraints] and [Data].”
Template in Action
Example
Act as a Psychology Instructor [Role] who is an expert in the works of Carl Jung [Behavioural Signals]. Create a quiz for students on Jungian Archetypes [Task]. This quiz should be 5 multiple choice questions [Structure]. Each question should have 4 answers, one correct and three distractors [Specifications/Constraints]. The questions should only explore the information contained in the 1964 book, Man and his Symbols [Data].
Generated Material (Copilot Web access. June 19, 2024)
Prompt Engineering – Templates RTAO
Prompt Template Patterns
Prompts play a pivotal role in the functionality of generative AI, acting as the fundamental channel of communication between the user and the AI. They are designed to direct the AI’s generation of specific outputs or execution of tasks. Any prompt will elicit a response, however, to elicit an effective response, the user must provide specific details required by the AI relevant to the request. Prompting templates can help the user in preparing effective prompts that include the detail required by the AI. This prompting template was adapted from the insights of Yi Zhou (2023).
RTAO Prompt Template Patterns
This template is simpler than the TOCD. This template focuses more on describing the task in standard English rather than describing each isolated component and relevant attribute. Similar to TOCD, this pattern consists of 4 main component parts.
Role
What part doe the AI Play?
Task
Function or action the AI is intended to execute
Audience
Specifies the target audience for the material generated
Output
Details required parameters around the presentation of the material
Implementation
This much simpler template asks for the user to consider these 4 components and then provide this information to the AI in the form of a prompt as indicated below.
Prompt Template
“Act as [role]. Perform [task] for [audience] in [output format].”
Template in Action
Example
Act as an expert in the works of Carl Jung [Role]. Create a 5-question multiple choice quiz on Jungian Archetypes [Task]. The audience for this quiz will be undergraduate students taking a Foundational theories of Psychology course at a university in Canada [Audience]. Each question should contain 1 correct answer and three distractors with the correct answer clearly indicated [Output].
Generated Material (Copilot. January 3, 2025)
I hope this quiz helps your students better understand Jungian Archetypes! If you need any further assistance, feel free to ask.
Prompt Engineering – Templates Comprehensive
Prompt Template Patterns
Prompts play a pivotal role in the functionality of generative AI, acting as the fundamental channel of communication between the user and the AI. They are designed to direct the AI’s generation of specific outputs or execution of tasks. Any prompt will elicit a response, however, to elicit an effective response, the user must provide specific details required by the AI relevant to the request. Prompting templates can help the user in preparing effective prompts that include the detail required by the AI. This prompting template was adapted from the insights of Yi Zhou (2023).
Comprehensive Prompt Template Patterns
This template is the most complex. The comprehensive template can address many situations while maintaining a defined and repeatable structure, regardless of the task. It is best used when maintaining a consistent prompt structure is important to the user. This template consists of 8 main component parts.
Disregard Prior Inputs
keeps responses current to this ask
Roles
the role the AI should assume
Context
sets the scene or background
Background
Deeper dive into past events
Goal
task that clarifies the objective
Output
format and constraints (Specific structure boundary)
Extra Information
Nuggets of details to fine tune the AI‘s response
Output evaluation
Benchmarks or metrics to evaluate the outputs accuracy
Implementation
Similar to the TOCD template, the user considers the components of the template relevant to the task. Prompting the AI to disregard prior inputs guarantees that each prompt will be treated as an initial prompt. Many of the other components are similar to the other template, until “extra information”. The comprehensive template is expected to be useful across many topics, tasks and outputs, so to support this, deliberate space to allow extra information unique to the needs of this specific task is defined.
Prompt Template
“[disregard prior inputs] + [role] + [context] + [background] + [goal] + [output] + [extra information] + [output evaluation].”
Template in Action
Example
Disregard Prior Inputs. Take the role of an expert in Jungian Archetypes. Prepare a 5-question multiple choice quiz on Jungian Archetypes. The quiz in for a group on university students studying foundational theories in psychology at a university in Canada. Each question should have one correct answer indicated and three distractors. This quiz is intended to provide motive for students to complete the readings rather than be a fulsome test of their knowledge. Please limit the questions to material from the 1964 book, Man and his Symbols.
Generated Material (Copilot. January 6, 2025)