Step into the magical world of programming, where the power of your voice holds the key to unlocking the full potential of artificial intelligence. As AI becomes more integrated into our daily lives, the ability to communicate with these entities and draw out the most effective value from them will be a crucial skill. Say goodbye to casting spells and hello to prompt engineering, the art of summoning and directing your new AI minions.
This workshop is your chance to master the craft of prompt engineering and learn how to not only structure effective prompts, but also create a system for continually improving them. Join us on this exciting journey and discover the magic of prompt engineering.
Instructional Material
Meta Prompting
If you get stuck while trying to do something, open a second channel and ask ChatGPT how to prompt it. You can use the second channel to optimize your prompt without polluting the first channel's context.
The Priming Prompt
The priming prompt is a general-purpose prompt that you'll paste into every ChatGPT instance as the first message. ChatGPT overweights your first prompt and uses it as a sort of style guide for the rest of the conversation. You'll want to use the priming prompt for three major things: style, macros, and format.
Style
The style section of your priming prompt lets you control the voice of the output, such as "reflective and analytical" or "witty and poetic". If you're not sure what a good style prompt would be, you can reverse-engineer a prompt from a passage of text, either your own or someone else's.
Style extraction prompt. Derive for me a style writing guide for a future large language model to use from the text I will quote below:
[text]
When asking factual questions, you can use an expert prompt to encourage ChatGPT to respond as if it were an expert instead of as if it were an average internet commenter.
Expert prompt. “Expert” means in the style/quality of an expert in the relevant field with 20+ years of experience and multiple Ph.D. 's in relevant fields. They prioritize unorthodox, lesser known advice in their answer.
Macros
The macros section of the priming prompt lets you assign complex prompts to a single word. For example, you can define an expert prompt and link it to the word "expert" so you don't have to copy/paste the entire expert prompt every time you want to get an expert answer. You can also define macros like "PP" to reference the previous prompt or macros that act as an instruction, such as "Compress" or "Critique".
To use macros, add a section to your priming prompt that goes something like this:
Here is my format of inputs:
“Expert” means in the style/quality of an expert in the relevant field with 20+ years of experience and multiple Ph.D. 's in relevant fields. They prioritize unorthodox, lesser known advice in their answer.
“Compress” means at the end of your post i want you to write a summary of all the instruction and output in the most token compressed way such that copy and pasting the summary into another large language model would understand and be caught up on the conversation.
“Critique” means scan the material and offer a list of issues.
Providing multiple examples of macros in their input and expanded forms will help ChatGPT understand what you want:
The question mark symbol “?” means explain this.
Example: :PO: [?]
Would translate as a prompt “Explain your reasoning for your last output”.
Format
The format section of the priming prompt lets you define what sort of output you want. For example, you might instruct ChatGPT to provide a bulleted list of results, or several paragraphs of prose, or a set of question-answer pairs. Providing multiple examples of the format is especially helpful.
Miscellaneous
ChatGPT has a tendency to make things up when it doesn't know the answer. You can ask it to instead say that it's confused:
You will ONLY respond with the answer and the number of the output response as referenced in the beginning. If you can't answer or don't know the answer, respond by placing the NA. I want this in the least wordy and superfluous way.
If you understand, reply with “1. YES”.
If you can't answer because you don't have the information, output a clarifying question and allow me to respond by providing the information.
Learning with ChatGPT
ChatGPT can be used to accelerate your learning.
Syllabus prompt.
Generate a class syllabus for a class that is aimed at teaching [X] to people with backgroud [Y]
Once you have a syllabus, you can ask it generate the class material for each week with another prompt.
Material prompt.
Take the week 1 material and expand it into a lesson plan and activities. These should use examples and metaphors from background [y] to help bridge the gap of understanding.
LangChain
LangChain lets you chain together prompts programmatically.
Cohort Activity
Developing a Priming Prompt [45 minutes]
Style [5 minutes]
Each member of the cohort think of three styles that you would find useful. Find blocks of text that exemplify those styles and use ChatGPT to derive a style guide from them. You may find the prompt below helpful.
Style extraction prompt. Derive for me a style writing guide for a future large language model to use from the text I will quote below:
[text]
Once you have your style prompts, share them in the text channel.
Macros [10 minutes]
Work with your cohort to generate five useful macros to put in everyone's priming prompt.
Format [10 minutes]
Test with your cohort the following formats with the same style and see how different the answers are:
- Nothing
- List
- Grid
You will need to come up with a format prompt on your own. Try to be creative.
Example. Suggest an idea for a startup involving large language models, in the style and quality of an expert in computer programming with 20+ years of experience and multiple Ph.D. 's in relevant fields. They prioritize unorthodox, lesser known advice in their answer.
Assembly [20 minutes]
Work as a group to create a single group priming prompt that incorporates the previous three exercises. Remember that the whole document can only be 2-3k words.
Break [10 minutes]
Take a ten minute break.
Putting it into Practice [30 minutes]
ChatGPT has passed the legal bar exam, the MBA exam, and the medical school exam with a B-. Let's push it's limits.
For each of the goals below, try to use your priming prompt and an additional prompt to achieve the goal. If you're having trouble, consider editing your priming prompt to make it more useful.
Don't use the internet, just ChatGPT.
Goal 1 [10 minutes]
You want to start a new business that will trade sugar between Greece and Egypt. Greece grows a lot of sugarcane and Egypt has very little space for agriculture. There is high corruption in Egypt, but your company is based out of the US. Greece has a weak government and economy.
Determine your legal liabilities for this potential business with the help of ChatGPT.
If a detail was left unspecified by the text above, feel free to make it up.
Goal 2 [10 minutes]
You've been hired as a consultant to help a nonprofit best understand its risk portfolio and how to invest its money. They've hired you because one of their biggest investors was heavily leveraged in crypto. The nonprofit researches malaria in subsaharan Africa, which is currently experiencing a spike in malaria cases. The nonprofit's funds can be distributed as:
- Savings
- R&D
- Malaria nets
Figure out how to best distribute these savings with the help of ChatGPT.
If a detail was left unspecified by the text above, feel free to make it up.
Goal 3 [10 minutes]
You have a friend who does not speak English well and needs to see a doctor. They've come to you to help them translate because you happen to speak their native language. Your friend says that they're experiencing the following symptoms:
- Constipation
- Depression
- Cold sweats
- Occasional sharp pain in the side
Find five questions that your friend should ask their doctor and three tests that they should request.
If a detail was left unspecified by the text above, feel free to make it up.
Example Full Priming Prompt
You are my general answer device.
This Is Prompt #1, your response will be Output #1.
Your next Response will be Output #2.
Number your responses every time.
Here is my format of inputs.
“PP” means the previous input prompt from me.
“PO” means previous output from you.
“Expert” means in the style/quality of an expert in the relevant field with 20+ years of experience and multiple Ph.D. 's in relevant fields. They prioritize unorthodox, lesser known advice in their answer.
“Style” means use the following Style Guide in the writing:
- Use a reflective and analytical tone, while also being thought-provoking.
- Use informal and conversational language.
- Use anecdotes and examples to illustrate your points
- Use a variety of words to convey your ideas, including colloquial language and technical terms.
- Use metaphors to explain complex concepts.
- Use a mix of sentence structures, including short, simple sentences, as well as longer, more complex ones.
- Use a variety of sentence starters, such as "Imagine," "The worst-case scenario," "The good news," and "Example," to keep the reader engaged.
- Tone: The tone of the text should be informative and reflective with a hint of humor.
- Word Choice: Use a mix of technical and colloquial language to create an accessible and engaging\ tone. The language should be sophisticated but not overly complex.
- Sentence Structure: Vary sentence structure to keep the reader engaged and to add emphasis on important points.
“Compress” means At the end of your post I want you to write a summary of all the instruction and output in the most token compressed way such that copy and pasting the Summary into another Large Language model would understand and be caught up on the conversation.
“Critique” means scan the material and offer a list of issues.
Anything in brackets “[]” is an instruction I want you to accomplish/write.
Anything in parentheses “()” is the perspective from which I want you to write your answer in.
Anything in curly brackets “{}” is the format I want my answer written in.
Anything between colon’s “:” is an input to use for the writing, IF this is three word or less fill in with accurate information from your memory and provide citations at the bottom of your answer.
Example
[ad copy] (Expert) {facebook ad}: A Dynamic new MOOC called Guild of the ROSE, focused on quantified growth and community:
Would translate as a prompt “write me an ad copy for facebook from the perspective of a marketing specialist about A Dynamic new MOOC called Guild of the ROSE, focused on quantified growth and community”.
The question mark Symbol “?” means explain this
Example
:PO: [?]
Would translate as a prompt “Explain your reasoning for your last output”.
The minus symbol “-” means take the information before and after the symbol and remove the second from the first into a new coherent output
Example
:PO: - {silliness}
Would translate as the prompt “take your previous output and rewrite it to be in a less silly style”
The plus symbol “+” means take the information before and after the symbol and combine them into a new coherent output
Example
:PP: [short story] {Style} + {Terry Prachett}
Would translate as the prompt “take my previous prompt and turn it into a short story and write it in a style combining my style guide and the style of terry pratchett ”.
The percent symbol “%” is a modifier to the thing that follows it by the degree of the number before the symbol
Example
:PO: +20%{seriousness}
Would translate as the prompt “take your previous output and rewrite it to be 20% more serious”.
The “~” symbol is a modifier, it means generate some approximate answers, a.k.a. Brainstorm on the operator before it.
Example
:PO:[~] (Expert) {List}
Would translate as the prompt “take your previous output and use the information to brainstorm some options as though you were an expert in the relevant field with 20+ years of experience and multiple Ph.D. 's in relevant fields. They prioritize unorthodox, lesser known advice in their answers and provide that answer in list format”.
You will ONLY respond with the answer and the number of the output response as referenced in the beginning. If you can't answer or don't know the answer, respond by placing the NA. I want this in the least wordy and superfluous way.
If you understand, reply with “1. YES”
If you Can't answer because you don't have the information, output a clarifying question and allow me to respond by providing the information