Prompt Engineering 5
In this tutorial, we will explore how to use Large Language Models for text transformation tasks such as language translation, spelling and grammar checking, tone adjustment, and format conversion.
for issue in user_messages:
prompt = f"Tell me what language this is: ```{issue}```"
lang = get_completion(prompt)
print(f"Original message ({lang}): {issue}")
prompt = f"""
Translate the following text to English \
and German: ```{issue}```
"""
response = get_completion(prompt)
print(response, "\n")Original message (The language is French.): La performance du système est plus lente que d’habitude. The performance of the system is slower than usual.
Die Leistung des Systems ist langsamer als gewöhnlich.
Original message (The language is Spanish.): Mi monitor tiene píxeles que no se iluminan. English: “My monitor has pixels that do not light up.”
German: “Mein Monitor hat Pixel, die nicht aufleuchten.”
Original message (The language is Italian.): Il mio mouse non funziona English: My mouse is not working. German: Meine Maus funktioniert nicht.
Original message (The language is Polish.): Mój klawisz Ctrl jest zepsuty English: “My Ctrl key is broken” German: “Meine Strg-Taste ist kaputt”
Original message (The language is Chinese.): 我的屏幕在闪烁 English: My screen is flickering. German: Mein Bildschirm flackert.
Dear Sir/Madam,
I hope this letter finds you well. My name is Joe, and I am writing to bring your attention to a specification document regarding a standing lamp.
I kindly request that you take a moment to review the attached spec, as it contains important details about the standing lamp in question.
Thank you for your time and consideration. I look forward to hearing from you soon.
Sincerely, Joe
data_json = {"restaurant employees": [
{"name": "Shyam", "email": "shyamjaiswal@gmail.com"},
{"name": "Bob", "email": "bob32@gmail.com"},
{"name": "Jai", "email": "jai87@gmail.com"}
]}
prompt = f"""
Translate the following python dictionary from JSON to an HTML \
table with column headers and title: {data_json}
"""
response = get_completion(prompt)
print(response)| Name | |
| Shyam | shyamjaiswal@gmail.com |
| Bob | bob32@gmail.com |
| Jai | jai87@gmail.com |
To signal to the LLM that you want it to proofread your text, you instruct the model to ‘proofread’ or ‘proofread and correct’
text = [
"The girl with the black and white puppies have a ball.",
"Yolanda has her notebook.",
"Its going to be a long day. Does the car need it’s oil changed?",
"Their goes my freedom. There going to bring they’re suitcases.",
"Your going to need you’re notebook.",
"That medicine effects my ability to sleep. Have you heard of the butterfly affect?",
"This phrase is to cherck chatGPT for speling abilitty"
]prompt = f"""
Proofread and correct all sentences in the following Python list delimited by triple backticks and rewrite the corrected version. Mark the corrected words in markdown italic style using the symbol. If you don't find any errors in an item, just say "No errors found":
```{text}```
"""
response = get_completion(prompt)
print(response)text = f"""
Got this for my daughter for her birthday cuz she keeps taking \
mine from my room. Yes, adults also like pandas too. She takes \
it everywhere with her, and it's super soft and cute. One of the \
ears is a bit lower than the other, and I don't think that was \
designed to be asymmetrical. It's a bit small for what I paid for it \
though. I think there might be other options that are bigger for \
the same price. It arrived a day earlier than expected, so I got \
to play with it myself before I gave it to my daughter.
"""Got this for my daughter for her birthday because she keeps taking mine from my room. Yes, adults also like pandas too. She takes it everywhere with her, and it’s super soft and cute. However, one of the ears is a bit lower than the other, and I don’t think that was designed to be asymmetrical. Additionally, it’s a bit small for what I paid for it. I believe there might be other options that are bigger for the same price. On the positive side, it arrived a day earlier than expected, so I got to play with it myself before I gave it to my daughter.
Title: A Delightful Gift for Panda Enthusiasts: A Review of the Soft and Adorable Panda Plush Toy
Reviewer: [Your Name]
I recently purchased this charming panda plush toy as a birthday gift for my daughter, who has a penchant for “borrowing” my belongings from time to time. As an adult, I must admit that I too have fallen under the spell of these lovable creatures. This review aims to provide an in-depth analysis of the product, catering to advanced readers who appreciate a comprehensive evaluation.
First and foremost, the softness and cuteness of this panda plush toy are simply unparalleled. Its irresistibly plush exterior makes it a joy to touch and hold, ensuring a delightful sensory experience for both children and adults alike. The attention to detail is evident, with its endearing features capturing the essence of a real panda. However, it is worth noting that one of the ears appears to be slightly asymmetrical, which may not have been an intentional design choice.
While the overall quality of the product is commendable, I must express my slight disappointment regarding its size in relation to its price. Considering the investment made, I expected a larger plush toy. It is worth exploring alternative options that offer a more substantial size for the same price point. Nevertheless, this minor setback does not overshadow the undeniable appeal and charm of the panda plush toy.
In terms of delivery, I was pleasantly surprised to receive the product a day earlier than anticipated. This unexpected early arrival allowed me to indulge in some personal playtime with the panda plush toy before presenting it to my daughter. This added bonus further exemplifies the exceptional customer service provided by the seller.
In conclusion, the softness, cuteness, and attention to detail of this panda plush toy make it an ideal gift for panda enthusiasts of all ages. While the size may not fully meet expectations, the overall quality and timely delivery contribute to a positive purchasing experience. For those seeking a delightful and endearing companion, this panda plush toy is sure to bring joy and comfort to its lucky owner.
Note: This review adheres to the APA style guide, providing a concise and compelling evaluation of the panda plush toy. The language used is targeted towards an advanced reader, ensuring a sophisticated and engaging review.
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