text = f""" In a charming village, siblings Jack and Jill set out on \ a quest to fetch water from a hilltop \ well. As they climbed, singing joyfully, misfortune \ struck—Jack tripped on a stone and tumbled \ down the hill, with Jill following suit. \ Though slightly battered, the pair returned home to \ comforting embraces. Despite the mishap, \ their adventurous spirits remained undimmed, and they \ continued exploring with delight. """ # example 1 prompt_1 = f""" Perform the following actions: 1 - Summarize the following text delimited by triple \ backticks with 1 sentence. 2 - Translate the summary into French. 3 - List each name in the French summary. 4 - Output a json object that contains the following \ keys: french_summary, num_names. Separate your answers with line breaks. Text: ```{text}``` """ response = get_completion(prompt_1) print("Completion for prompt 1:") print(response)
prompt = f""" Determine if the student's solution is correct or not. Question: I'm building a solar power installation and I need \ help working out the financials. - Land costs $100 / square foot - I can buy solar panels for $250 / square foot - I negotiated a contract for maintenance that will cost \ me a flat $100k per year, and an additional $10 / square \ foot What is the total cost for the first year of operations as a function of the number of square feet. Student's Solution: Let x be the size of the installation in square feet. Costs: 1. Land cost: 100x 2. Solar panel cost: 250x 3. Maintenance cost: 100,000 + 100x Total cost: 100x + 250x + 100,000 + 100x = 450x + 100,000 """ response = get_completion(prompt) print(response)
要求模型给出自己的解,再得出结论:
1 2 3 4 5 6 7 8 9 10 11 12
prompt = f""" Your task is to determine if the student's solution \ is correct or not. To solve the problem do the following: - First, work out your own solution to the problem. - Then compare your solution to the student's solution \ and evaluate if the student's solution is correct or not. Don't decide if the student's solution is correct until you have done the problem yourself. Use the following format: Question:
question here
1
Student's solution:
student’s solution here
1
Actual solution:
steps to work out the solution and your solution here
1 2
Is the student's solution the same as actual solution \ just calculated:
yes or no
1
Student grade:
correct or incorrect
1 2
Question:
I’m building a solar power installation and I need help working out the financials.
Land costs $100 / square foot
I can buy solar panels for $250 / square foot
I negotiated a contract for maintenance that will cost me a flat $100k per year, and an additional $10 / square foot What is the total cost for the first year of operations as a function of the number of square feet.
1
Student's solution:
Let x be the size of the installation in square feet. Costs:
Actual solution: """ response = get_completion(prompt) print(response)
模型限制:幻觉(Hallucinations)
就是常说的模型“一本正经胡说八道”,会对可能的结果(并不真实存在)做出描述。
1
Tell me about AeroGlide UltraSlim Smart Toothbrush by boie
1 2 3 4 5
The AeroGlide UltraSlim Smart Toothbrush by Boie is a high-tech toothbrush that incorporates advanced features to provide an optimal teeth cleaning experience. It uses patented AeroGlide bristles to gently yet effectively clean teeth and gums, reducing the risk of gum disease and cavities. The bristles are made from an ultra-soft material that is gentle on tooth enamel and won't scratch or damage it.
The toothbrush also features a smart timer that ensures users brush their teeth for the recommended two minutes, and a rechargeable battery that provides up to two weeks of use on a single charge. Additionally, it comes with a sleek travel case that makes it easy to take the toothbrush with you on the go.
Overall, the AeroGlide UltraSlim Smart Toothbrush by Boie is a great choice for those who want a high-quality, effective toothbrush that incorporates advanced features to improve their oral health.
Got this panda plush toy for my daughter's birthday, \ who loves it and takes it everywhere. It's soft and \ super cute, and its face has a friendly look. It's \ a bit small for what I paid 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 her.
提示指令:
有字数限制的总结
1 2 3 4 5 6 7
Your task is to generate a short summary of a product \ review from an ecommerce site.
Summarize the review below, delimited by triple backticks, in at most 30 words.
Review: ```{prod_review}```
关注某个方面(示例中为:交付/快递)的总结
1 2 3 4 5 6 7 8 9
Your task is to generate a short summary of a product \ review from an ecommerce site to give feedback to the \ Shipping deparmtment.
Summarize the review below, delimited by triple backticks, in at most 30 words, and focusing on any aspects \ that mention shipping and delivery of the product.
Review: ```{prod_review}```
关注某几个方面(示例中为:价格及价值)的总结
1 2 3 4 5 6 7 8 9 10
Your task is to generate a short summary of a product \ review from an ecommerce site to give feedback to the \ pricing deparmtment, responsible for determining the \ price of the product.
Summarize the review below, delimited by triple backticks, in at most 30 words, and focusing on any aspects \ that are relevant to the price and perceived value.
Review: ```{prod_review}```
使用“抽取”(extract)代替“总结”(summarize)
1 2 3 4 5 6 7 8 9
Your task is to extract relevant information from \ a product review from an ecommerce site to give \ feedback to the Shipping department.
From the review below, delimited by triple quotes \ extract the information relevant to shipping and \ delivery. Limit to 30 words.
Review: ```{prod_review}```
推断
案例(推断产品评论是正向还是负向)
1 2 3 4 5 6 7 8 9
Needed a nice lamp for my bedroom, and this one had \ additional storage and not too high of a price point. \ Got it fast. The string to our lamp broke during the \ transit and the company happily sent over a new one. \ Came within a few days as well. It was easy to put \ together. I had a missing part, so I contacted their \ support and they very quickly got me the missing piece! \ Lumina seems to me to be a great company that cares \ about their customers and products!!
提示指令:
产品评论情感是正向还是负向
1 2 3 4
What is the sentiment of the following product review, which is delimited with triple backticks?
Review text: '''{lamp_review}'''
简化回答
1 2 3 4 5 6 7
What is the sentiment of the following product review, which is delimited with triple backticks?
Give your answer as a single word, either "positive" \ or "negative".
Review text: '''{lamp_review}'''
识别情绪类型(多个,用“,” 连接)
1 2 3 4 5 6
Identify a list of emotions that the writer of the \ following review is expressing. Include no more than \ five items in the list. Format your answer as a list of \ lower-case words separated by commas.
Review text: '''{lamp_review}'''
识别愤怒
1 2 3 4 5
Is the writer of the following review expressing anger?\ The review is delimited with triple backticks. \ Give your answer as either yes or no.
Review text: '''{lamp_review}'''
从用户评论中提取产品及公司名
1 2 3 4 5 6 7 8 9 10 11 12
Identify the following items from the review text: - Item purchased by reviewer - Company that made the item
The review is delimited with triple backticks. \ Format your response as a JSON object with \ "Item" and "Brand" as the keys. If the information isn't present, use "unknown" \ as the value. Make your response as short as possible. Review text: '''{lamp_review}'''
In a recent survey conducted by the government, public sector employees were asked to rate their level of satisfaction with the department they work at. The results revealed that NASA was the most popular department with a satisfaction rating of 95%.
One NASA employee, John Smith, commented on the findings, stating, "I'm not surprised that NASA came out on top. It's a great place to work with amazing people and incredible opportunities. I'm proud to be a part of such an innovative organization."
The results were also welcomed by NASA's management team, with Director Tom Johnson stating, "We are thrilled to hear that our employees are satisfied with their work at NASA. We have a talented and dedicated team who work tirelessly to achieve our goals, and it's fantastic to see that their hard work is paying off."
The survey also revealed that the Social Security Administration had the lowest satisfaction rating, with only 45% of employees indicating they were satisfied with their job. The government has pledged to address the concerns raised by employees in the survey and work towards improving job satisfaction across all departments.
提示指令
推断5个主题
1 2 3 4 5 6 7 8
Determine five topics that are being discussed in the \ following text, which is delimited by triple backticks.
Make each item one or two words long.
Format your response as a list of items separated by commas.
Text sample: '''{story}'''
对特定主题设置提醒,进行监控
1 2 3 4 5 6 7 8 9 10 11 12 13
prompt = f""" Determine whether each item in the following list of \ topics is a topic in the text below, which is delimited with triple backticks. Give your answer as list with 0 or 1 for each topic.\ List of topics: {", ".join(topic_list)} Text sample: '''{story}''' """ response = get_completion(prompt) print(response)
1 2 3 4 5
nasa: 1 local government: 0 engineering: 0 employee satisfaction: 1 federal government: 1
1 2 3
topic_dict = {i.split(': ')[0]: int(i.split(': ')[1]) for i in response.split(sep='\n')} if topic_dict['nasa'] == 1: print("ALERT: New NASA story!")
1
ALERT: New NASA story!
转换(Transforming)
翻译
案例 不同语言的翻译
提示指令:
1 2
Translate the following English text to Spanish: \ ```Hi, I would like to order a blender```
检测是哪种语言?
1 2
Tell me which language this is: '''Combien coûte le lampadaire?'''
翻译多个语言
1 2 3
Translate the following text to French and Spanish and English pirate: \ '''I want to order a basketball'''
翻译为书面语及非书面语
1 2 3
Translate the following text to Spanish in both the \ formal and informal forms: 'Would you like to order a pillow?'
多种语言翻译为统一语言
1 2 3 4 5 6 7
user_messages = [ "La performance du système est plus lente que d'habitude.", # System performance is slower than normal "Mi monitor tiene píxeles que no se iluminan.", # My monitor has pixels that are not lighting "Il mio mouse non funziona", # My mouse is not working "Mój klawisz Ctrl jest zepsuty", # My keyboard has a broken control key "我的屏幕在闪烁"# My screen is flashing ]
1 2 3 4 5 6 7 8 9 10 11
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 Korean: ```{issue}``` """ response = get_completion(prompt) print(response, "\n")
语气转换(Tone transformation)
1 2
Translate the following from slang to a business letter: 'Dude, This is Joe, check out this spec on this standing lamp.
1 2 3 4 5 6 7 8 9
Dear Sir/Madam,
I am writing to bring to your attention a standing lamp that I believe may be of interest to you. Please find attached the specifications for your review.
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)
from IPython.display import display, Markdown, Latex, HTML, JSON display(HTML(response))
拼写/语法检查
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
text = [ "The girl with the black and white puppies have a ball.", # The girl has a ball. "Yolanda has her notebook.", # ok "Its going to be a long day. Does the car need it’s oil changed?", # Homonyms "Their goes my freedom. There going to bring they’re suitcases.", # Homonyms "Your going to need you’re notebook.", # Homonyms "That medicine effects my ability to sleep. Have you heard of the butterfly affect?", # Homonyms "This phrase is to cherck chatGPT for speling abilitty"# spelling ] for t in text: prompt = f"""Proofread and correct the following text and rewrite the corrected version. If you don't find and errors, just say "No errors found". Don't use any punctuation around the text: ```{t}```""" response = get_completion(prompt) print(response)
提示指令关键词:
proofread (校对)
rewrite (重写)
correct (纠正)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
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. """ prompt = f"proofread and correct this review: ```{text}```" response = get_completion(prompt) print(response)
prompt = f""" proofread and correct this review. Make it more compelling. Ensure it follows APA style guide and targets an advanced reader. Output in markdown format. Text: ```{text}``` """ response = get_completion(prompt) display(Markdown(response))
# given the sentiment from the lesson on "inferring", # and the original customer message, customize the 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. """
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
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)
1 2 3 4 5 6 7 8 9 10 11
Dear Valued Customer,
Thank you for taking the time to leave a review about our product. We are sorry to hear that you experienced an increase in price and that the quality of the product did not meet your expectations. We apologize for any inconvenience this may have caused you.
We would like to assure you that we take all feedback seriously and we will be sure to pass your comments along to our team. If you have any further concerns, please do not hesitate to reach out to our customer service team for assistance.
Thank you again for your review and for choosing our product. We hope to have the opportunity to serve you better in the future.