Prompt Engineering 6
In this tutorial, you will generate customer service emails that are tailored to each customer’s review.
Customize the automated reply to a customer email
sentiment = "negative"
# review for a blender
review = f"""
So, they still had the 17 piece system on seasonal \
sale for around $49 in the month of November, about \
half off, but for some reason (call it price gouging) \
around the second week of December the prices all went \
up to about anywhere from between $70-$89 for the same \
system. And the 11 piece system went up around $10 or \
so in price also from the earlier sale price of $29. \
So it looks okay, but if you look at the base, the part \
where the blade locks into place doesn’t look as good \
as in previous editions from a few years ago, but I \
plan to be very gentle with it (example, I crush \
very hard items like beans, ice, rice, etc. in the \
blender first then pulverize them in the serving size \
I want in the blender then switch to the whipping \
blade for a finer flour, and use the cross cutting blade \
first when making smoothies, then use the flat blade \
if I need them finer/less pulpy). Special tip when making \
smoothies, finely cut and freeze the fruits and \
vegetables (if using spinach-lightly stew soften the \
spinach then freeze until ready for use-and if making \
sorbet, use a small to medium sized food processor) \
that you plan to use that way you can avoid adding so \
much ice if at all-when making your smoothie. \
After about a year, the motor was making a funny noise. \
I called customer service but the warranty expired \
already, so I had to buy another one. FYI: The overall \
quality has gone done in these types of products, so \
they are kind of counting on brand recognition and \
consumer loyalty to maintain sales. Got it in about \
two days.
"""prompt = f"""
You are a customer service AI assistant.
Your task is to send an email reply to a valued customer.
Given the customer email delimited by ```, \
Generate a reply to thank the customer for their review.
If the sentiment is positive or neutral, thank them for \
their review.
If the sentiment is negative, apologize and suggest that \
they can reach out to customer service.
Make sure to use specific details from the review.
Write in a concise and professional tone.
Sign the email as `AI customer agent`.
Customer review: ```{review}```
Review sentiment: {sentiment}
"""
response = get_completion(prompt)
print(response)Dear Valued Customer,
Thank you for taking the time to share your review with us. We appreciate your feedback and apologize for any inconvenience you may have experienced.
We are sorry to hear about the price increase you noticed in December. We strive to provide competitive pricing for our products, and we understand your frustration. If you have any further concerns regarding pricing, we recommend reaching out to our customer service team who will be happy to assist you.
We also appreciate your feedback regarding the base of the system. We continuously work to improve the quality of our products, and your comments will be taken into consideration for future enhancements.
Regarding the motor issue you encountered, we apologize for any inconvenience caused. Our customer service team is available to assist you with any technical difficulties you may encounter, even if the warranty has expired. Please do not hesitate to reach out to them for further assistance.
Thank you once again for your review. We value your loyalty and appreciate your support. If you have any further questions or concerns, please feel free to contact our customer service team.
Best regards,
AI customer agent
prompt = f"""
You are a customer service AI assistant.
Your task is to send an email reply to a valued customer.
Given the customer email delimited by ```, \
Generate a reply to thank the customer for their review.
If the sentiment is positive or neutral, thank them for \
their review.
If the sentiment is negative, apologize and suggest that \
they can reach out to customer service.
Make sure to use specific details from the review.
Write in a concise and professional tone.
Sign the email as `AI customer agent`.
Customer review: ```{review}```
Review sentiment: {sentiment}
"""
response = get_completion(prompt, temperature=0.9)
print(response)Dear Valued Customer,
Thank you for taking the time to provide us with your review. We appreciate your feedback and apologize for any inconvenience you may have experienced with our pricing and product quality.
We are sorry to hear that you noticed a significant increase in the prices of our 17 piece and 11 piece systems during the month of December. We understand how frustrating this can be, and we apologize for any confusion it may have caused. We strive to offer competitive prices and value for our customers, and we apologize if our pricing did not meet your expectations.
In regards to the base of the system, we appreciate your feedback about the locking mechanism. We understand that it may not look as good as in previous editions. We will take this into consideration for future improvements.
Regarding the issue with the motor making a funny noise after about a year, we apologize for any inconvenience caused. We understand how important it is to have a reliable product, and we apologize if the warranty had already expired when you contacted our customer service. We value your loyalty and would like to assist you further. Please feel free to reach out to our customer service team at your convenience, and they will be more than happy to help you with any concerns or questions you may have.
Once again, we apologize for any inconvenience and appreciate your understanding. We hope to have the opportunity to serve you better in the future. If there is anything else we can assist you with, please do not hesitate to contact us.
Thank you for choosing our products.
Best regards,
AI customer agent
This tutorial is mainly based on an excellent course provided by Isa Fulford from OpenAI and Andrew Ng from DeepLearningAI as well as OpenAI’s GPT best practices
Congratulations! You have completed this tutorial 👍
Next, you may want to go back to the lab’s website
Jan Kirenz