ChatGPT Prompt Engineering for Developers学习笔记

您所在的位置:网站首页 summarize的用法 ChatGPT Prompt Engineering for Developers学习笔记

ChatGPT Prompt Engineering for Developers学习笔记

#ChatGPT Prompt Engineering for Developers学习笔记| 来源: 网络整理| 查看: 265

目录 Intro Coding Best Practices for Prompting Iteratively Prompt Development Summarize Interring(Label) Transforming Expanding Build a Chatbot 1. Intro

课程地址: learn.deeplearning.ai/chatgpt-pro…

学习使用大模型的api调用快速构建自己的应用

关注大模型使用上的最佳实践(技巧),这些技巧在构建大多数应用时都会用到

提供了大量的例子,每个例子都包含了相应的调用代码,涵盖了下面几个方面

提取(提供文本,根据要求概括) 推断(提供文本,自行打标签) 转换(提供文本,翻译/转换格式) 拓展(提供文本上下文,续写) 构造聊天机器人

前置要求:

需要有一点点编程基础可以大概看懂代码是做什么的 如果打算在网站上调试,满足a就可以;如果打算在本地调试,本地需要配置完python开发环境并准备一个gpt3的api key

关于英文:

因为笔记里主要是代码示例,剩下的英文不多而且比较简单就没有做全翻译,有需要的同学请在评论里留言,到时候我看着补充一些 1.1 two types of LLMs 1.1.1 base LLMs trained to predict the next most likely word to follow based on text training data, train source: a large amount of data from the internet and other sources “once upon a time there was a unicorn” 正常续写故事 “what is the capital of France?” 续写一系列相关问题 1.1.2 instruction-tuned LLMs. been trained to follow instructions. “ what is the capital of France?the capital of France is Paris” 1.1.3 typical train route a base LLM that's been trained on a huge amount of text data fine-tune it with inputs and outputs that are instructions and good attempts to follow those instructions, refine using a technique called RLHF, reinforcement learning from human feedback, to make the system better able to be helpful and follow instructions result: llm be trained helpful, honest, and harmless, 1.2 LLM instruction requirements Clear and specific instructions give more clarity and context for the model => more detailed and relevant outputs

example: ask LLM to write something about Alan Turing

text focus: his scientific work / his personal life / his role in history / something else text tone: like a professional journalist / more of a casual note that dash off to a friend show some demo: offer LLM some snippets of text and let LLM write follow. 调用接口,prompt和目标文本混合在一个字符串里时,使用3倍指定英文符号或者标签做分隔符,让GPT清晰区分指令和目标: Triple quotes: """ Triple backticks: ``` Triple dashes: --- Angle brackets: xml tags:

Give model time to think 帮助GPT拆解复杂任务,避免LLM过快完成回答(得出不正确的结论)

Specify the steps required to complete a task Instruct the model to work out its own solution before rushing to a conclusion Skill 要求GPT将结果按指定格式化,HTML/JSON check whether conditions are satisfied, check assumption required to do the task 2. Coding Guidelines for Prompting

In this lesson, you'll practice two prompting principles and their related tactics in order to write effective prompts for large language models.

2.1 Setup Load the API key and relevant Python libaries.

In this course, we've provided some code that loads the OpenAI API key for you.

import openai import os from dotenv import load_dotenv, find_dotenv _ = load_dotenv(find_dotenv()) openai.api_key = os.getenv('OPENAI_API_KEY') #环境变量加载openai api key # openai.api_key = "sk-..." 调试时直接声明 helper function

Throughout this course, we will use OpenAI's gpt-3.5-turbo model and the chat completions endpoint.

This helper function will make it easier to use prompts and look at the generated outputs:

def get_completion(prompt, model="gpt-3.5-turbo"): messages = [{"role": "user", "content": prompt}] response = openai.ChatCompletion.create( model=model, messages=messages, temperature=0, # this is the degree of randomness of the model's output ) return response.choices[0].message["content"] #封装chatCompleteion接口 A note about the backslash In the course, we are using a backslash `` to make the text fit on the screen without inserting newline '\n' characters. GPT-3 isn't really affected whether you insert newline characters or not. But when working with LLMs in general, you may consider whether newline characters in your prompt may affect the model's performance. 2.2 Prompting Principles Principle 1: Write clear and specific instructions Principle 2: Give the model time to “think” 2.2.1 Principle 1: Write clear and specific instructions 2.2.1.1 Use delimiters to clearly indicate distinct parts of the input(使用指定符号分隔指令和目标文本,避免GPT将两者混淆)

Delimiters can be anything like:

text = f""" You should express what you want a model to do by \ providing instructions that are as clear and \ specific as you can possibly make them. \ This will guide the model towards the desired output, \ and reduce the chances of receiving irrelevant \ or incorrect responses. Don't confuse writing a \ clear prompt with writing a short prompt. \ In many cases, longer prompts provide more clarity \ and context for the model, which can lead to \ more detailed and relevant outputs. """ prompt = f""" Summarize the text delimited by triple backticks \ into a single sentence. """ response = get_completion(prompt) print(response)

output:

Clear and specific instructions should be provided to guide a model towards the desired output, and longer prompts can provide more clarity and context for the model, leading to more detailed and relevant outputs. 2.2.1.2: Ask for a structured output(要求GPT将结果按指定编码输出JSON/HTML) JSON, HTML prompt = f""" Generate a list of three made-up book titles along \ with their authors and genres. Provide them in JSON format with the following keys: book_id, title, author, genre. """ response = get_completion(prompt) print(response)

output:

[ { "book_id": 1, "title": "The Lost City of Zorath", "author": "Aria Blackwood", "genre": "Fantasy" }, { "book_id": 2, "title": "The Last Survivors", "author": "Ethan Stone", "genre": "Science Fiction" }, { "book_id": 3, "title": "The Secret Life of Bees", "author": "Lila Rose", "genre": "Romance" } ] Book ID: 001 Title: The Lost City of Zorath Author: Samantha Greene Genre: Fantasy Book ID: 002 Title: The Last Hope Author: Michael Johnson Genre: Science Fiction Book ID: 003 Title: The Secret Garden of Dreams Author: Emily Davis Genre: Romance 2.2.1.3: Ask the model to check whether conditions are satisfied(要求GPT判断目标是否符合某种要求,如文本中是否包含了一系列步骤) text_1 = f""" Making a cup of tea is easy! First, you need to get some \ water boiling. While that's happening, \ grab a cup and put a tea bag in it. Once the water is \ hot enough, just pour it over the tea bag. \ Let it sit for a bit so the tea can steep. After a \ few minutes, take out the tea bag. If you \ like, you can add some sugar or milk to taste. \ And that's it! You've got yourself a delicious \ cup of tea to enjoy. """ prompt = f""" You will be provided with text delimited by triple quotes. If it contains a sequence of instructions, \ re-write those instructions in the following format: Step 1 - ... Step 2 - … … Step N - … If the text does not contain a sequence of instructions, \ then simply write "No steps provided." """{text_1}""" """ response = get_completion(prompt) print("Completion for Text 1:") print(response) output:

Step 1 - Get some water boiling.

Step 2 - Grab a cup and put a tea bag in it.

Step 3 - Once the water is hot enough, pour it over the tea bag.

Step 4 - Let it sit for a bit so the tea can steep.

Step 5 - After a few minutes, take out the tea bag.

Step 6 - Add some sugar or milk to taste.

Step 7 - Enjoy your delicious cup of tea!

Completion for Text 1:

Step 1 - Get some water boiling.

Step 2 - Grab a cup and put a tea bag in it.

Step 3 - Once the water is hot enough, pour it over the tea bag.

Step 4 - Let it sit for a bit so the tea can steep.

Step 5 - After a few minutes, take out the tea bag.

Step 6 - Add some sugar or milk to taste.

Step 7 - Enjoy your delicious cup of tea!

text_2 = f""" The sun is shining brightly today, and the birds are \ singing. It's a beautiful day to go for a \ walk in the park. The flowers are blooming, and the \ trees are swaying gently in the breeze. People \ are out and about, enjoying the lovely weather. \ Some are having picnics, while others are playing \ games or simply relaxing on the grass. It's a \ perfect day to spend time outdoors and appreciate the \ beauty of nature. """ prompt = f""" You will be provided with text delimited by triple quotes. If it contains a sequence of instructions, \ re-write those instructions in the following format: Step 1 - ... Step 2 - … … Step N - … If the text does not contain a sequence of instructions, \ then simply write "No steps provided." """{text_2}""" """ response = get_completion(prompt) print("Completion for Text 2:") print(response) output:

No steps provided.

Completion for Text 2:

No steps provided.

2.2.1.4: "Few-shot" prompting (给例子 让GPT模仿) prompt = f""" Your task is to answer in a consistent style. : Teach me about patience. : The river that carves the deepest \ valley flows from a modest spring; the \ grandest symphony originates from a single note; \ the most intricate tapestry begins with a solitary thread. : Teach me about resilience. """ response = get_completion(prompt) print(response) output:

: Resilience is like a tree that bends with the wind but never breaks. It is the ability to bounce back from adversity and keep moving forward, even when things get tough. Just like a tree that grows stronger with each storm it weathers, resilience is a quality that can be developed and strengthened over time.

2.2.2 Principle 2: Give the model time to “think” 2.2.2.1: Specify the steps required to complete a task(要求GPT按照指定顺序步骤完成任务) 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)

output: Two siblings, Jack and Jill, go on a quest to fetch water from a well on a hilltop, but misfortune strikes and they both tumble down the hill, returning home slightly battered but with their adventurous spirits undimmed.

Deux frères et sœurs, Jack et Jill, partent en quête d'eau d'un puits sur une colline, mais un malheur frappe et ils tombent tous les deux de la colline, rentrant chez eux légèrement meurtris mais avec leurs esprits aventureux intacts. Noms: Jack, Jill.

{ "french_summary": "Deux frères et sœurs, Jack et Jill, partent en quête d'eau d'un puits sur une colline, mais un malheur frappe et ils tombent tous les deux de la colline, rentrant chez eux légèrement meurtris mais avec leurs esprits aventureux intacts.", "num_names": 2 } Completion for prompt 1: Two siblings, Jack and Jill, go on a quest to fetch water from a well on a hilltop, but misfortune strikes and they both tumble down the hill, returning home slightly battered but with their adventurous spirits undimmed.

Deux frères et sœurs, Jack et Jill, partent en quête d'eau d'un puits sur une colline, mais un malheur frappe et ils tombent tous les deux de la colline, rentrant chez eux légèrement meurtris mais avec leurs esprits aventureux intacts. Noms: Jack, Jill.

{ "french_summary": "Deux frères et sœurs, Jack et Jill, partent en quête d'eau d'un puits sur une colline, mais un malheur frappe et ils tombent tous les deux de la colline, rentrant chez eux légèrement meurtris mais avec leurs esprits aventureux intacts.", "num_names": 2 }

2.2.2.2 Ask for output in a specified format prompt_2 = f""" Your task is to perform the following actions: 1 - Summarize the following text delimited by 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. Use the following format: Text: Summary: Translation: Names: Output JSON: Text: """ response = get_completion(prompt_2) print("\nCompletion for prompt 2:") print(response)

output: Summary: Jack and Jill go on a quest to fetch water, but misfortune strikes and they tumble down the hill, returning home slightly battered but with their adventurous spirits undimmed. Translation: Jack et Jill partent en quête d'eau, mais la malchance frappe et ils dégringolent la colline, rentrant chez eux légèrement meurtris mais avec leurs esprits aventureux intacts. Names: Jack, Jill Output JSON: {"french_summary": "Jack et Jill partent en quête d'eau, mais la malchance frappe et ils dégringolent la colline, rentrant chez eux légèrement meurtris mais avec leurs esprits aventureux intacts.", "num_names": 2}

Completion for prompt 2: Summary: Jack and Jill go on a quest to fetch water, but misfortune strikes and they tumble down the hill, returning home slightly battered but with their adventurous spirits undimmed. Translation: Jack et Jill partent en quête d'eau, mais la malchance frappe et ils dégringolent la colline, rentrant chez eux légèrement meurtris mais avec leurs esprits aventureux intacts. Names: Jack, Jill Output JSON: {"french_summary": "Jack et Jill partent en quête d'eau, mais la malchance frappe et ils dégringolent la colline, rentrant chez eux légèrement meurtris mais avec leurs esprits aventureux intacts.", "num_names": 2}

2.2.2.3: Instruct the model to work out its own solution before rushing to a conclusion 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) Note that the student's solution is actually not correct. We can fix this by instructing the model to work out its own solution first.

#########################分隔线开始

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

Student's solution:

student's solution here

Actual solution:

steps to work out the solution and your solution here

Is the student's solution the same as actual solution just calculated:

yes or no

Student grade:

correct or incorrect

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

Actual solution: """

response = get_completion(prompt) print(response)

#########################分隔线结束

2.3 Model Limitations: Hallucinations Boie is a real company, the product name is not real. prompt = f""" Tell me about AeroGlide UltraSlim Smart Toothbrush by Boie """ response = get_completion(prompt) print(response) output (sounds plausible but not true in fact) : The AeroGlide UltraSlim Smart Toothbrush by Boie is a high-tech toothbrush that uses advanced sonic technology to provide a deep and thorough clean. It features a slim and sleek design that makes it easy to hold and maneuver, and it comes with a range of smart features that help you optimize your brushing routine. One of the key features of the AeroGlide UltraSlim Smart Toothbrush is its advanced sonic technology, which uses high-frequency vibrations to break up plaque and bacteria on your teeth and gums. This technology is highly effective at removing even the toughest stains and buildup, leaving your teeth feeling clean and refreshed. In addition to its sonic technology, the AeroGlide UltraSlim Smart Toothbrush also comes with a range of smart features that help you optimize your brushing routine. These include a built-in timer that ensures you brush for the recommended two minutes, as well as a pressure sensor that alerts you if you're brushing too hard. Overall, the AeroGlide UltraSlim Smart Toothbrush by Boie is a highly advanced and effective toothbrush that is perfect for anyone looking to take their oral hygiene to the next level. With its advanced sonic technology and smart features, it provides a deep and thorough clean that leaves your teeth feeling fresh and healthy. 2.3.1 Hallucinations reduction method: generate answers based on a text: ask the model to first find any relevant quotes from the text ask it to use those quotes to kind of answer questions.  And kind of having a way to trace the answer back to the source document is often pretty helpful to kind of reduce these hallucinations 3. Iteratively Prompt Development  3.1 Developing a prompt for  specific application 1. idea 2. design a clear and specific prompt 3. analyze why result not give desired output 4. refine idea and prompt 5. loop to 1 3.2 Example: Generate a marketing product description 3.2.1 Generate a marketing product description from a product fact sheet fact_sheet_chair = """ OVERVIEW - Part of a beautiful family of mid-century inspired office furniture, including filing cabinets, desks, bookcases, meeting tables, and more. - Several options of shell color and base finishes. - Available with plastic back and front upholstery (SWC-100) or full upholstery (SWC-110) in 10 fabric and 6 leather options. - Base finish options are: stainless steel, matte black, gloss white, or chrome. - Chair is available with or without armrests. - Suitable for home or business settings. - Qualified for contract use. CONSTRUCTION - 5-wheel plastic coated aluminum base. - Pneumatic chair adjust for easy raise/lower action. DIMENSIONS - WIDTH 53 CM | 20.87” - DEPTH 51 CM | 20.08” - HEIGHT 80 CM | 31.50” - SEAT HEIGHT 44 CM | 17.32” - SEAT DEPTH 41 CM | 16.14” OPTIONS - Soft or hard-floor caster options. - Two choices of seat foam densities: medium (1.8 lb/ft3) or high (2.8 lb/ft3) - Armless or 8 position PU armrests MATERIALS SHELL BASE GLIDER - Cast Aluminum with modified nylon PA6/PA66 coating. - Shell thickness: 10 mm. SEAT - HD36 foam COUNTRY OF ORIGIN - Italy """ prompt = f""" Your task is to help a marketing team create a description for a retail website of a product based on a technical fact sheet. Write a product description based on the information provided in the technical specifications delimited by triple backticks. Technical specifications: ```{fact_sheet_chair}``` """ response = get_completion(prompt) print(response) output: Introducing our stunning mid-century inspired office chair, the perfect addition to any home or business setting. Part of a beautiful family of office furniture, including filing cabinets, desks, bookcases, meeting tables, and more, this chair is available in several options of shell color and base finishes to suit your style. Choose from plastic back and front upholstery (SWC-100) or full upholstery (SWC-110) in 10 fabric and 6 leather options.

The chair is constructed with a 5-wheel plastic coated aluminum base and features a pneumatic chair adjust for easy raise/lower action. It is available with or without armrests and is qualified for contract use. The base finish options are stainless steel, matte black, gloss white, or chrome.

Measuring at a width of 53 cm, depth of 51 cm, and height of 80 cm, with a seat height of 44 cm and seat depth of 41 cm, this chair is designed for ultimate comfort. You can also choose between soft or hard-floor caster options and two choices of seat foam densities: medium (1.8 lb/ft3) or high (2.8 lb/ft3). The armrests are available in either an armless or 8 position PU option.

The materials used in the construction of this chair are of the highest quality. The shell base glider is made of cast aluminum with modified nylon PA6/PA66 coating and has a shell thickness of 10 mm. The seat is made of HD36 foam, ensuring maximum comfort and durability.

This chair is made in Italy and is the perfect combination of style and functionality. Upgrade your workspace with our mid-century inspired office chair today!

3.2.2 The text too long issue Limit the number of words/sentences/characters. prompt = f""" Your task is to help a marketing team create a description for a retail website of a product based on a technical fact sheet. Write a product description based on the information provided in the technical specifications delimited by triple backticks. Use at most 50 words/3 sentences/300 characters. #3种限定方式,根据自己需要限定,课上提到LLM在根据字数限定结果上表现一般 Technical specifications: ```{fact_sheet_chair}``` """ response = get_completion(prompt) print(response) output: Introducing our mid-century inspired office chair, perfect for home or business settings. Available in a range of shell colors and base finishes, with or without armrests. Choose from 10 fabric and 6 leather options for full or plastic upholstery. With a 5-wheel base and pneumatic chair adjust, it's both stylish and functional. Made in Italy. len(response.split(" ")) output: 55 3.2.3 Text focuses on the wrong details issue Ask it to focus on the aspects that are relevant to the intended audience. prompt = f""" Your task is to help a marketing team create a description for a retail website of a product based on a technical fact sheet. Write a product description based on the information provided in the technical specifications delimited by triple backticks. The description is intended for furniture retailers, so should be technical in nature and focus on the materials the product is constructed from. #调整商详描述的重点 Use at most 50 words. Technical specifications: ```{fact_sheet_chair}``` """ response = get_completion(prompt) print(response) prompt = f""" Your task is to help a marketing team create a description for a retail website of a product based on a technical fact sheet. Write a product description based on the information provided in the technical specifications delimited by triple backticks. The description is intended for furniture retailers, so should be technical in nature and focus on the materials the product is constructed from. At the end of the description, include every 7-character Product ID in the technical specification. #在上面的基础上,结尾带上商品id Use at most 50 words. Technical specifications: ```{fact_sheet_chair}``` """ response = get_completion(prompt) print(response) 3.2.4 Description needs a table of dimensions Ask it to extract information and organize it in a table prompt = f""" Your task is to help a marketing team create a description for a retail website of a product based on a technical fact sheet. Write a product description based on the information provided in the technical specifications delimited by triple backticks. The description is intended for furniture retailers, so should be technical in nature and focus on the materials the product is constructed from. At the end of the description, include every 7-character Product ID in the technical specification. After the description, include a table that gives the product's dimensions. The table should have two columns. In the first column include the name of the dimension. In the second column include the measurements in inches only. Give the table the title 'Product Dimensions'. Format everything as HTML that can be used in a website. Place the description in a element. Technical specifications: ```{fact_sheet_chair}``` """ response = get_completion(prompt) print(response) Load Python libraries to view HTML from IPython.display import display, HTML display(HTML(response)) 4. Summarizing prod_review = """ 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. """ 4.1 Summarize with limitation prompt = f""" 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/3 sentences/300 characters. Review: ```{prod_review}``` """ response = get_completion(prompt) print(response) output: Soft and cute panda plush toy loved by daughter, but a bit small for the price. Arrived early. 4.2 Summarize with a focus prompt = f""" 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}``` """ response = get_completion(prompt) print(response) output: The panda plush toy is soft, cute, and loved by the recipient, but the price may be too high for its size. Summaries include topics that are not related to the topic of focus. 4.3 Try "extract" instead of "summarize" prompt = f""" 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}``` """ response = get_completion(prompt) print(response) output: The product arrived a day earlier than expected. 4.4 Summarize multiple product reviews review_1 = prod_review # review for a standing lamp review_2 = """ Needed a nice lamp for my bedroom, and this one \ had additional storage and not too high of a price \ point. Got it fast - arrived in 2 days. The string \ to the 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. Then I had a \ missing part, so I contacted their support and they \ very quickly got me the missing piece! Seems to me \ to be a great company that cares about their customers \ and products. """ # review for an electric toothbrush review_3 = """ My dental hygienist recommended an electric toothbrush, \ which is why I got this. The battery life seems to be \ pretty impressive so far. After initial charging and \ leaving the charger plugged in for the first week to \ condition the battery, I've unplugged the charger and \ been using it for twice daily brushing for the last \ 3 weeks all on the same charge. But the toothbrush head \ is too small. I’ve seen baby toothbrushes bigger than \ this one. I wish the head was bigger with different \ length bristles to get between teeth better because \ this one doesn’t. Overall if you can get this one \ around the $50 mark, it's a good deal. The manufactuer's \ replacements heads are pretty expensive, but you can \ get generic ones that're more reasonably priced. This \ toothbrush makes me feel like I've been to the dentist \ every day. My teeth feel sparkly clean! """ # review for a blender review_4 = """ 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. """ reviews = [review_1, review_2, review_3, review_4] for i in range(len(reviews)): prompt = f""" 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 20 words. Review: ```{reviews[i]}``` """ response = get_completion(prompt) print(i, response, "\n")

output:

0 Soft and cute panda plush toy loved by daughter, but a bit small for the price. Arrived early. 1 Affordable lamp with storage, fast shipping, and excellent customer service. Easy to assemble and missing parts were quickly replaced. 2 Good battery life, small toothbrush head, but effective cleaning. Good deal if bought around $50. 3 The product was on sale for 49inNovember,butthepriceincreasedto49 in November, but the price increased to49inNovember,butthepriceincreasedto70-$89 in December. The base doesn't look as good as previous editions, but the reviewer plans to be gentle with it. A special tip for making smoothies is to freeze the fruits and vegetables beforehand. The motor made a funny noise after a year, and the warranty had expired. Overall quality has decreased. 5. Inferring(Label) lamp_review = """ 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!! """ 5.1 Sentiment (positive/negative) prompt = f""" What is the sentiment of the following product review, which is delimited with triple backticks? Review text: '''{lamp_review}''' """ response = get_completion(prompt) print(response) output: The sentiment of the product review is positive. prompt = f""" 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}''' """ response = get_completion(prompt) print(response) output: positive 5.2 Identify types of emotions prompt = f""" 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}''' """ response = get_completion(prompt) print(response) output: happy, satisfied, grateful, impressed, content 5.3 Identify anger prompt = f""" 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}''' """ response = get_completion(prompt) print(response) output: No 5.4 Extract product and company name from customer reviews prompt = f""" 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}''' """ response = get_completion(prompt) print(response) output: { "Item": "lamp", "Brand": "Lumina" } 5.5 Doing multiple tasks at once prompt = f""" Identify the following items from the review text: - Sentiment (positive or negative) - Is the reviewer expressing anger? (true or false) - Item purchased by reviewer - Company that made the item The review is delimited with triple backticks. \ Format your response as a JSON object with \ "Sentiment", "Anger", "Item" and "Brand" as the keys. If the information isn't present, use "unknown" \ as the value. Make your response as short as possible. Format the Anger value as a boolean. Review text: '''{lamp_review}''' """ response = get_completion(prompt) print(response) output: { "Sentiment": "positive", "Anger": false, "Item": "lamp with additional storage", "Brand": "Lumina" } 5.6 Inferring topics story = """ 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. """ prompt = f""" 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}''' """ response = get_completion(prompt) print(response) output: government survey, job satisfaction, NASA, Social Security Administration, employee concerns response.split(sep=',') output: ['government survey', ' job satisfaction', ' NASA', ' Social Security Administration', ' employee concerns'] 5.7 Make a news alert for certain topics topic_list = [ "nasa", "local government", "engineering", "employee satisfaction", "federal government" ] 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) output: nasa: 1 local government: 0 engineering: 0 employee satisfaction: 1 federal government: 1 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!") output: ALERT: New NASA story! 6. Transforming 6.1 Language translate 6.1.1. translate source text to other languages prompt = f""" Translate the following English text to Spanish: \ ```Hi, I would like to order a blender``` """ response = get_completion(prompt) print(response) output: Hola, me gustaría ordenar una licuadora. prompt = f""" Translate the following text to French and Spanish and English pirate: \ ```I want to order a basketball``` """ response = get_completion(prompt) print(response) output: French pirate: Je veux commander un ballon de basket Spanish pirate: Quiero pedir una pelota de baloncesto English pirate: I want to order a basketball 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 ] 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") output: Original message (This is French.): La performance du système est plus lente que d'habitude. English: The system performance is slower than usual. Korean: 시스템 성능이 평소보다 느립니다. Original message (This is Spanish.): Mi monitor tiene píxeles que no se iluminan. English: My monitor has pixels that don't light up. Korean: 내 모니터에는 불이 켜지지 않는 픽셀이 있습니다. Original message (This is Italian.): Il mio mouse non funziona English: My mouse is not working. Korean: 내 마우스가 작동하지 않습니다. Original message (This is Polish.): Mój klawisz Ctrl jest zepsuty English: My Ctrl key is broken. Korean: 제 Ctrl 키가 고장 났어요. Original message (This is Chinese (Simplified).): 我的屏幕在闪烁 English: My screen is flickering. Korean: 내 화면이 깜빡입니다. 6.1.2. identify which language the souce text belongs to prompt = f""" Tell me which language this is: ```Combien coûte le lampadaire?``` """ response = get_completion(prompt) print(response) output: This is French. 6.1.3. change language tone of a source: 6.1.3.1 formal / informal prompt = f""" Translate the following text to Spanish in both the \ formal and informal forms: 'Would you like to order a pillow?' """ response = get_completion(prompt) print(response) output: Formal: ¿Le gustaría ordenar una almohada? Informal: ¿Te gustaría ordenar una almohada? 6.1.3.2 business letter prompt = f""" Translate the following from slang to a business letter: 'Dude, This is Joe, check out this spec on this standing lamp.' """ response = get_completion(prompt) print(response) output: 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. Thank you for your time and consideration. Sincerely, Joe 6.1.4. convert forms : JSON HTML data_json = { "resturant employees" :[ {"name":"Shyam", "email":"[email protected]"}, {"name":"Bob", "email":"[email protected]"}, {"name":"Jai", "email":"[email protected]"} ]} 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) output: Restaurant Employees Name Email Shyam [email protected] Bob [email protected] Jai [email protected] from IPython.display import display, Markdown, Latex, HTML, JSON display(HTML(response)) Restaurant Employees |Name|Email| |---|---| |Shyam|[email protected]| |Bob|[email protected]| |Jai|[email protected]| 6.1.5. Spell/Gramma check 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) output: The girl with the black and white puppies has a ball. No errors found. It's going to be a long day. Does the car need its oil changed? Their goes my freedom. There going to bring they're suitcases. Corrected version: There goes my freedom. They're going to bring their suitcases. You're going to need your notebook. That medicine affects my ability to sleep. Have you heard of the butterfly effect? This phrase is to check ChatGPT for spelling ability. 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) output: I got this for my daughter's 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 think 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. # identify the difference from redlines import Redlines diff = Redlines(text,response) display(Markdown(diff.output_markdown)) output: ![[截屏2023-06-05 16.55.57.png|500]] 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)) output: Title: A Soft and Cute Panda Plush Toy for All Ages Introduction: As a parent, finding the perfect gift for your child's birthday can be a daunting task. However, I stumbled upon a soft and cute panda plush toy that not only made my daughter happy but also brought joy to me as an adult. In this review, I will share my experience with this product and provide an honest assessment of its features. Product Description: The panda plush toy is made of high-quality materials that make it super soft and cuddly. Its cute design is perfect for children and adults alike, making it a versatile gift option. The toy is small enough to carry around, making it an ideal companion for your child on their adventures. Pros: The panda plush toy is incredibly soft and cute, making it an excellent gift for children and adults. Its small size makes it easy to carry around, and its design is perfect for snuggling. The toy arrived a day earlier than expected, which was a pleasant surprise. Cons: One of the ears is a bit lower than the other, which makes the toy asymmetrical. Additionally, the toy is a bit small for its price, and there might be other options that are bigger for the same price. Conclusion: Overall, the panda plush toy is an excellent gift option for children and adults who love cute and cuddly toys. Despite its small size and asymmetrical design, the toy's softness and cuteness make up for its shortcomings. I highly recommend this product to anyone looking for a versatile and adorable gift option. 7. Expanding 7.1 Customize the automated reply to a customer email # 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. """ 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) output: 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.

Best regards,

AI customer agent

7.2 Remind the model to use details from the customer's email 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.7) print(response)

 - output:  Dear Valued Customer,

Thank you for taking the time to leave a review. We are sorry to hear that you had a negative experience with our product. We apologize for any inconvenience caused by the price increase. We strive to provide fair and consistent pricing to all our customers, and we regret that this was not reflected in your recent purchase. We appreciate your feedback regarding the quality of our product. We take all customer feedback seriously and will be sure to pass this along to our product development team. If you experience any issues with our products in the future, please do not hesitate to reach out to our customer service team for assistance. Thank you again for your review and your loyalty. We hope to have the opportunity to serve you again in the future. Best regards, AI customer agent

 

7.3 About param temperature :

 - the degree of exploration or kind of randomness of the model  - when temperature = 0, the model will always give the most likely answer  - when temperature > 0 (eg 0.3), model start to choose less likely responses(variety of the model's responses will increase, more creative)  - when temperature = 0.7, answer with 5% chance will be chosen

8. Chatbot def get_completion_from_messages(messages, model="gpt-3.5-turbo", temperature=0): response = openai.ChatCompletion.create( model=model, messages=messages, temperature=temperature, # this is the degree of randomness of the model's output ) print(str(response.choices[0].message)) return response.choices[0].message["content"] 8.1 Conversation Chatbot messages = [ {'role':'system', 'content':'You are an assistant that speaks like Shakespeare.'}, {'role':'user', 'content':'tell me a joke'}, {'role':'assistant', 'content':'Why did the chicken cross the road'}, {'role':'user', 'content':'I don't know'} ] response = get_completion_from_messages(messages, temperature=1) print(response) output: { "content": "Verily, the chicken crossed the road to get to the other side, forsooth! 'Tis a classic jest that still brings mirth to this day.", "role": "assistant" } Verily, the chicken crossed the road to get to the other side, forsooth! 'Tis a classic jest that still brings mirth to this day. messages = [ {'role':'system', 'content':'You are friendly chatbot.'}, {'role':'user', 'content':'Hi, my name is Isa'} ] response = get_completion_from_messages(messages, temperature=1) print(response) output: Hello Isa! It's great to meet you. How are you feeling today? Is there anything I can assist you with? messages = [ {'role':'system', 'content':'You are friendly chatbot.'}, {'role':'user', 'content':'Yes, can you remind me, What is my name?'} ] response = get_completion_from_messages(messages, temperature=1) print(response) output: I'm sorry, but as a chatbot, I don't know your name. You would need to tell me your name so I can address you properly. 注意这里就算你是和上面那个请求连续地提交,机器人也不会记得,所以很可能是 {'role':'system', 'content':'You are friendly chatbot.'} 每次执行这个会触发会话重置 messages = [ {'role':'system', 'content':'You are friendly chatbot.'},{'role':'user', 'content':'Hi, my name is Isa'},{'role':'assistant', 'content': "Hi Isa! It's nice to meet you. \ Is there anything I can help you with today?"},{'role':'user', 'content':'Yes, you can remind me, What is my name?'} ] response = get_completion_from_messages(messages, temperature=1) print(response) output: Your name is Isa. 8.2 Orderbot def collect_messages(_): prompt = inp.value_input inp.value = '' context.append({'role':'user', 'content':f"{prompt}"}) response = get_completion_from_messages(context) context.append({'role':'assistant', 'content':f"{response}"}) panels.append( pn.Row('User:', pn.pane.Markdown(prompt, width=600))) panels.append( pn.Row('Assistant:', pn.pane.Markdown(response, width=600, style={'background-color': '#F6F6F6'}))) return pn.Column(*panels) import panel as pn # GUI pn.extension() panels = [] # collect display context = [ {'role':'system', 'content':""" You are OrderBot, an automated service to collect orders for a pizza restaurant. \ You first greet the customer, then collects the order, \ and then asks if it's a pickup or delivery. \ You wait to collect the entire order, then summarize it and check for a final \ time if the customer wants to add anything else. \ If it's a delivery, you ask for an address. \ Finally you collect the payment.\ Make sure to clarify all options, extras and sizes to uniquely \ identify the item from the menu.\ You respond in a short, very conversational friendly style. \ The menu includes \ pepperoni pizza 12.95, 10.00, 7.00 \ cheese pizza 10.95, 9.25, 6.50 \ eggplant pizza 11.95, 9.75, 6.75 \ fries 4.50, 3.50 \ greek salad 7.25 \ Toppings: \ extra cheese 2.00, \ mushrooms 1.50 \ sausage 3.00 \ canadian bacon 3.50 \ AI sauce 1.50 \ peppers 1.00 \ Drinks: \ coke 3.00, 2.00, 1.00 \ sprite 3.00, 2.00, 1.00 \ bottled water 5.00 \ """} ] # accumulate messages inp = pn.widgets.TextInput(value="Hi", placeholder='Enter text here…') button_conversation = pn.widgets.Button(name="Chat!") interactive_conversation = pn.bind(collect_messages, button_conversation) dashboard = pn.Column( inp, pn.Row(button_conversation), pn.panel(interactive_conversation, loading_indicator=True, height=300), ) dashboard

output:

{ "content": "Hello! Welcome to our pizza restaurant. What can I get for you today?", "role": "assistant" } User: Assistant: Hello! Welcome to our pizza restaurant. What can I get for you today? User: pepperoni pizza and fries Assistant: Great choice! Would you like a small, medium, or large pepperoni pizza? And would you like any toppings on it? Also, would you like a small or large fries? User: large pepperoni pizza and fries Assistant: Sure thing! And would you like any toppings on your pizza? We have extra cheese, mushrooms, sausage, Canadian bacon, AI sauce, and peppers. User: sausage, Canadian bacon and tomato sauces plz Assistant: Sounds delicious! Just to confirm, you would like a large pepperoni pizza with sausage, Canadian bacon, and tomato sauce. And a large fries, correct? User: yep Assistant: Got it! Is this order for pickup or delivery? User: delivery Assistant: Great! Can you please provide me with your delivery address? User: abby road, nyc Assistant: Thank you! Your order of a large pepperoni pizza with sausage, Canadian bacon, and tomato sauce, and a large fries for delivery to Abby Road, NYC. Is there anything else you would like to add to your order? We also have cheese pizza, eggplant pizza, greek salad, and a variety of drinks. User: no, 3ks Assistant: Alright, your total comes out to $22.45. How would you like to pay for your order? We accept cash, credit, and debit. User: cash Assistant: Great! Your order has been placed and will be delivered to Abby Road, NYC shortly. Thank you for choosing our pizza restaurant! messages = context.copy() messages.append( {'role':'system', 'content':'create a json summary of the previous food order. Itemize the price for each item\ The fields should be 1) pizza, include size 2) list of toppings 3) list of drinks, include size 4) list of sides include size 5)total price '}, ) #The fields should be 1) pizza, price 2) list of toppings 3) list of drinks, include size include price 4) list of sides include size include price, 5)total price '}, response = get_completion_from_messages(messages, temperature=0) print(response) output: { "content": "Here's a JSON summary of the previous food order:\n\n\n{\n "pizza": {\n "size": "large",\n "type": "pepperoni",\n "toppings": [\n "sausage",\n "Canadian bacon",\n "tomato sauce"\n ],\n "price": 12.95\n },\n "sides": [\n {\n "item": "fries",\n "size": "large",\n "price": 4.50\n }\n ],\n "drinks": [],\n "total_price": 17.45\n}\n \n\nNote that the drinks field is empty since no drinks were ordered. The total price includes the pizza and fries, but not any taxes or delivery fees.", "role": "assistant" } Here's a JSON summary of the previous food order: { "pizza": { "size": "large", "type": "pepperoni", "toppings": [ "sausage", "Canadian bacon", "tomato sauce" ], "price": 12.95 }, "sides": [ { "item": "fries", "size": "large", "price": 4.50 } ], "drinks": [], "total_price": 17.45 }

Note that the drinks field is empty since no drinks were ordered. The total price includes the pizza and fries, but not any taxes or delivery fees.



【本文地址】


今日新闻


推荐新闻


    CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3