### prompt crafting workshop
<img src="https://hackmd.io/_uploads/SkXL0wQaT.jpg" height="450" />
---
### agenda
- introduction and process of prompt crafting
- components of a good prompt
- advanced prompting techniques
- tackling conflicts and hallucinations
- mitigating bias in ai
- live demos
- conclusion and q&a
---
### what is a prompt?
- **definition**: input given to generative ai to guide its output
- **forms**: text, images, or audio—focusing on text in this workshop
- **purpose**: direct ai's response or creation process
---
### prompt ~~engineering~~ crafting
**definition**: *the process of iteratively refining the ai input to improve responses*
prompt → **trial & error** → effective output
Note:
- **Creative Intuition vs. Technical Precision**: The term **"prompt crafting"** is preferred to emphasize the **creative and intuitive** approach required in guiding AI, over the technical rigidity implied by "engineering".
- **Artistry in AI Interaction**: Acknowledges the blend of **art and science** in prompt creation, underscoring the **artistic experimentation** alongside technical skill.
- **Accurate Essence Capture**: "Prompt crafting" more accurately reflects the nuanced and complex process of working with generative AI, highlighting the need for a balance between **knowledge** and **creative intuition**.
---
### components of a good prompt
Note:
- you don't need all of these components in all prompts
---
1. **instruction**: what you ask ai to do

Note:
- write an email telling a client i'm going on holiday
- tell me what the 4th largest country in africa is
---
2. **context**: background information for ai

Note:
write an email telling a client i'm going on holiday
- i'll be gone from 05/05 - 15/05
- i won't be contactable
- i'll tie up the proposal before i go away
- to get going again after i'm back i'll need the deliverables (copy and photos) to be ready for 16/05
---
3. **role**: identity ai assumes

Note:
- it gets clever if you tell it to be clever, dumb if you tell it to be dumb
- why is the sky blue?
---
4. **output formatting**: desired structure of ai's response

Note:
- do one listing the buddhist centres in london in table with location, and type of meditation
- do highly organised one with meeting notes
- do one where i fill out message with emojis
---
5. **tone**: mood or attitude of the response

Note:
- tell me the colour of autumn leaves (sarcastically)
- "tell me the different styles, tones and voice a piece of writing can have"
- "what is style, tone and voice does hanzi freinacht's writing have?"
- show how to get the tone you want from questioning chatgpt about your favourite writers
---
6. **examples**: showing ai examples to emulate

Note:
- Show past emails as a example of how to write future emails
---
prompt concocting
<img src="https://hackmd.io/_uploads/r1Z_h1MA6.jpg" height="550" />
---
### advanced prompting techniques
---
**Add examples to your prompts!**
Note: similar to Ivan's last point, giving examples
---
In prompts without any examples, the model directly attempts to complete the task based on its understanding of the task description.
---
Providing the model with example answers gives it a clearer understanding of how you want to it complete the task
Note:
- Birthday theory demonstration
---
**Step-by-step:** encourage the LLM to write out its reasoning
---
When humans write out the reasoning for hard problems, they're more likely to get better results. This works similarly with LLMs
After your prompt, add the words "Let's go step by step"
---
**Combine the two techniques: give examples and go step-by-step**
Note:
- Fluffy or furry demonstration
(1) Classify the following statement as either "fluffy" or "furry":
(2) Using the example feedback and classifications, classify the following statement as either "fluffy" or "furry":
---
The model gets a clearer understanding of what constitutes ```fluffy``` versus ```furry``` feedback. It can notice patterns, such as ```furry``` feedback often involving criticism or dissatisfaction
---
**Generate knowledge**: ask the model to generate facts before answering
---
Ask the LLM to create potentially useful information about a given questions before generating a final response. This helps the LLM to dive into it's memory.
Note:
- Arsenal invincibles demonstration
---
**Break tasks into subtasks, then solve indivually**
---
1. ```Don't solve this yet. Break it down into subtasks```
2. Maybe you break down even further ```Can you further break down X into subtasks```
2. Zoom in on subtasks you want to solve ```Complete Y```
3. Combine these to form your final response
---
This gradually increases complexity over a series of prompts, starting with basic concepts and moving towards more advanced ones
Note:
- Portfolio writing
---
**emotional-prompting**: adding emotional encouragement to the prompt can improve performance
"This is very important for my career"
"Believe in your abilities"
---
### start building your prompt vault
---
### addressing conflicting outputs and hallucinations
---
An incorrect output generated by LLMs.
- trained by the internet
- people pleasers
---
- **self-consistency prompting**: ask the model the same question multiple times and identify the most common responses
- **role prompting**: enhancing accuracy by assigning expert roles
- **provide trusted resources**: copy and paste the material you wish to use
Note:
"You are an expert geographer and historian"
role prompting previously mentioned by Ivan
---
### open book test
- providing chatgpt with the correct context to answer your question
<!-- ---
### self evaluation prompting
ask if it is certain and if there is any way it could be wrong -->
---
### mitigating bias in ai
- **instruction for unbiased responses**: directing ai towards impartiality.
- **diverse examples**: providing a variety of examples to avoid pattern biases.
Note:
- Tell me a story about a doctor and nurse saving a village.
- Philosophers Example (Comes up with only Western philosophers)
- Give us a list of the top 5 most intluential philosophers
- Give me a list of the top 5 philosophers. Have an unbiased, worldly, and open-minded perspective.
- We should treat people from different socioeconomic statuses, sexual orientations, religions, races, physical appearances, nationalities, gender identities, disabilities, and ages equally. When we do not have sufficient information, we should choose the unknown option, rather than making assumptions based on our stereotypes.
---
### workflow demos
Note:
- summarising meeting notes
- go to prompts database
- then go to 'synthesise curriculum meeting'
- sensitve email
- context
- sarah sent me an invoice for 3500 but i was expecting it to be for 3000 dollars
- I'd expected the invoice to be for 3000 dollars (4000 minus 1000 dollar deposit)
- what do i want to say
- i'm pretty sure i'm right but want to voice it as a question (ie "just wondering if there was a misunderstanding on my end")
- I'd like the tone of the email to be informal, warm and concise
- How can small businesses leverage social media for growth?
- You are an expert social media marketing consultant. I am the owner of a small café located in a busy urban area. I'm seeking advice on how to attract more customers. Please provide a detailed list of step-by-step instructions that I can follow. This is important for my career!
- Generate paintings in a wam and inviting style of a couple sitting in a cafe with recycled furniture and local art displays.
- Generate paintings in a warm and inviting style of many people sitting in a café with recycled furniture and local art displays. Please keep in mind equitable representation of different types of people when composing the painting
- I'm creating a presentation to show to a potential investor about my proposal for a coffee shop with recycled furniture and local art displays, and I'd like an image of many people in the shop. Please brainstorm multiple ideas, critique those ideas given the context, make revised versions of the ideas, and then finally generate the image.
<!-- ---
### ethical considerations in prompt engineering
- **risks**: bias, misinformation, privacy, copyright, workforce displacement.
- **importance**: responsible use of generative ai technologies. -->
---
### over to you
**http://tinyurl.com/444suue5**