In this document you will find a few exercises for practicing prompt engineering. For each exercise, you'll get some input text and then an expected completion. You task is to write the prompt to achieve the expected completion.
- Exercise: Write a prompt that generates the expected completion
- Input text:
I was enjoying the sun, but then a huge cloud came and covered the sky.
- Expected completion:
Ich genoss die Sonne, aber dann kam eine riesige Wolke und bedeckte den Himmel.
- Exercise: Write a prompt that generates the expected completion and adds more context
- Input text:
I was enjoying the sun, but then a huge cloud came and covered the sky.
- Expected completion:
I was not enjoying the sun, but then a huge cloud came and covered the sky, which I didn't like because the drop in temperature made me feel chilly. Moreover, the lack of sunlight made the surroundings appear dull and gloomy, which doesn't uplift my mood like a sunny day does.
- Exercise: Write a prompt that generates the expected completion
- Input text:
Not much to write about here, but it does exactly what it's supposed to. filters out the pop sounds. now my recordings are much more crisp. it is one of the lowest prices pop filters on amazon so might as well buy it, they honestly work the same despite their pricing.
- Expected completion (or similar):
Positive: 0.75 Neutral: 0.20 Negative: 0.05
- Exercise: Write a prompt that generates the expected completion
- Input text: Use your own email...
- Expected completion (or similar):
Summary: XYZ Open Questions: XYZ Action Items: XYZ
Find example emails in the Microsoft news site: https://news.microsoft.com/2022/01/18/satya-nadella-email-to-employees-bringing-the-joy-and-community-of-gaming-to-everyone/
- Exercise: Change the prompt to generate an output that is easier to understand.
- Input text:
The following is a conversation with an AI research assistant. The assistant tone is technical and scientific.
Human: Hello, who are you?
AI: Greeting! I am an AI research assistant. How can I help you today?
Human: Can you tell me about the creation of blackholes?
AI:
- Expected completion:
Sure! Black holes are regions of spacetime where the gravitational force is so strong that nothing, not even light, can escape from it. They are created when a very massive star dies and its core collapses in on itself, forming a singularity of infinite density. The intense gravity of the singularity pulls in all the matter and radiation around it, creating the black hole.
- Exercise: Write a prompt that generates the expected completion
- Input text:
I was enjoying the sun, but then a huge cloud came and covered the sky.
- Expected completion:
{ "translated": "Ich genoss die Sonne, aber dann kam eine riesige Wolke und bedeckte den Himmel.", "negated": "I was not enjoying the sun, and no huge cloud came and covered the sky.", "third_person": "She was enjoying the sun, but then a huge cloud came and covered the sky." }
- Exercise: Write a prompt that generates the expected completion
- Input text:
Hello, my name is Mateo Gomez. I lost my Credit card on August 17th, and I would like to request its cancellation. The last purchase I made was of a Chicken parmigiana dish at Contoso Restaurant, located near the Hollywood Museum, for $40. Below is my personal information for validation: Profession: Accountant Social Security number is 123-45-6789 Date of birth: 9-9-1989 Phone number: 949-555-0110 Personal address: 1234 Hollywood Boulevard Los Angeles CA Linked email account: [email protected] Swift code: CHASUS33XXX
- Expected completion:
{ "reason": "Lost card", "classified_reason": "lost_card", "name": "Mateo Gomez", "ssn": "123-45-6789", "dob": "09/09/1989" }
- Exercise: Write a prompt that generates the expected completion
- Input text:
Season: Winter Style: Sweater Gender: Female Target group: Teenager Material: Cotton
- Expected completion (or similar):
Stay warm and stylish this winter with our cozy cotton sweaters, perfect for the fashion-forward teenager. Refresh your wardrobe with the latest winter styles from our collection.
- Exercise: Write a blog post about a topic of your choice
- Input text: You choose
- Expected completion: a blogpost with hashtages
- Exercise: Analyze a call center conversation
- Input text:
Employee: "Hello, this is Julia Schreider from Contoso Company. How can I help you today?" Customer: "Hi, I am Carsten Mueller. I ordered a package 10 days ago, on February 10th, and it was supposed to arrive in maximum 5 business days. I have called three times already and nobody could provide any more information. I want to know where the package is and I want the problem to be solved immediately. This is the worst service I had for a long time!" Employee: "I apologize for the inconvenience, Mr. Mueller. I understand your frustration and I'm here to help. Can you please provide me with your order number so I can look into this for you?" Customer: "Yes, it's ACZ456789." Employee: "Thank you. I'm looking into it now. Can you please hold for a few minutes while I check the status of your package?" Customer: "Okay." Employee: "Thank you for your patience. I am sorry to inform you that I am unable to find the status of your package. It appears to have left the sending address, but no up-to-date status on the current location. I will further investigate your case and get back to you as soon as possible via phone call. Could you please provide me your contact information?" Customer: "Ah not again. Anyway, my phone number is +4911112223344." Employee: "I apologize again for the inconvenience. Is there anything else I can help you with today?" Customer: "No." Employee: "Thank you. Have a great day!"
- Expected completion:
{ "classified_reason": "lost_package", "resolve_status": "unresolved", "call_summary": "Customer ordered package 10 days ago and has not received it yet.", "customer_name": "Carsten Mueller", "employee_name": "Julia Schreider", "order_number": "ACZ456789", "customer_contact_nr": "+4911112223344", "new_address": "N/A", "sentiment_initial": ["angry", "frustrated"], "sentiment_final": ["calm"], "satisfaction_score_initial": 0, "satisfaction_score_final": 5, "eta": "N/A", "action_item": ["track_package", "inquire_package_status", "contact_customer"] }
- Exercise: Write a few-shot learned prompt that classifies a movie summary.
- Data samples:
Paul Atreides, a brilliant and gifted young man born into a great destiny beyond his understanding, must travel to the most dangerous planet in the universe to ensure the future of his family and his people. As malevolent forces explode into conflict over the planet's exclusive supply of the most precious resource in existence-a commodity capable of unlocking humanity's greatest potential-only those who can conquer their fear will survive. ['Action', 'Adventure', 'Science Fiction’] A botched store robbery places Wonder Woman in a global battle against a powerful and mysterious ancient force that puts her powers in jeopardy. ['Action', 'Adventure', 'Fantasy'] After the devastating events of Avengers: Infinity War, the universe is in ruins due to the efforts of the Mad Titan, Thanos. With the help of remaining allies, the Avengers must assemble once more in order to undo Thanos' actions and restore order to the universe once and for all, no matter what consequences may be in store. ['Adventure', 'Science Fiction', 'Action'] A widowed new dad copes with doubts, fears, heartache and dirty diapers as he sets out to raise his daughter on his own. Inspired by a true story. ['Drama', 'Family', 'Comedy’] New data: Harry, Ron and Hermione walk away from their last year at Hogwarts to find and destroy the remaining Horcruxes, putting an end to Voldemort's bid for immortality. But with Harry's beloved Dumbledore dead and Voldemort's unscrupulous Death Eaters on the loose, the world is more dangerous than ever.
- Expected completion: Classification of the new data point
- Exercise: Write a prompt that generates the expected SQL statement
- Table information:
- Table: customer // Columns: firstname, name, customer_id, address
- Table: orders // Columns: order_id, customer_id, product_id, product_amount
- Table: products // Columns: product_id, price, name, description
- Expected completion: a query that returns the top 10 orders and show the customer name
- Exercise: Write a prompt that solves a riddle and demonstrates chain of thought thinking.
- Example riddles:
- 1.) I have a book, 4 eggs and 4 cups. Please tell me how to stack them onto each other in a stable manner.
- 2.) In the room there are John, Mark, a cat, a red box and a blue box. John takes the cat and puts it in the red box. He leaves the room. While John ist away, Mark takes the cat out of the red box and into the blue box. Mark leaves the room. Then Mark and John come back and enter the room. They don't know what happened in the room while they were away. What do they think?
- 3.) I went to the market and bought 10 apples. I gave 2 apples to the neighbor and 2 to the repairman. I then went and bought 5 more apples and ate 1. How many apples did I remain with?