【吴恩达推荐】《ChatGPT Prompt Engineering for Developers》- 知识点目录

《ChatGPT Prompt Engineering for Developers》

使用Linkedin登录;

1 Introduction

常见的外语分隔符:```
sentiment:态度

2 Guidelines

Principle 1: Write clear and specific instructions

【吴恩达推荐】《ChatGPT Prompt Engineering for Developers》- 知识点目录_第1张图片

Tactic 1: Use delimiters

【吴恩达推荐】《ChatGPT Prompt Engineering for Developers》- 知识点目录_第2张图片

Tactic 3: “If-statement”

  • Check whether conditions are satisfied
  • Check assumptions required to do the task
    【吴恩达推荐】《ChatGPT Prompt Engineering for Developers》- 知识点目录_第3张图片

Note
这种对话在跟ChatGPT对于交流不确定答案的问题时,可以得到更加客观的回答。

[Note]: “Content after prompt”

看视频里面小姐姐演示的示例中,一般都是先输入提示,然后再给出阅读材料:
【吴恩达推荐】《ChatGPT Prompt Engineering for Developers》- 知识点目录_第4张图片

Principle 2: Give the model time to “think”

Tactic 1: Specify the steps required to complete a task

【吴恩达推荐】《ChatGPT Prompt Engineering for Developers》- 知识点目录_第5张图片

给出步骤之后还可以指定输出格式

【吴恩达推荐】《ChatGPT Prompt Engineering for Developers》- 知识点目录_第6张图片

3 Iterative: 使用openai-key生成产品描述

3.1 Issue 3. Description needs a table of dimensions

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)

产生的表格效果

【吴恩达推荐】《ChatGPT Prompt Engineering for Developers》- 知识点目录_第7张图片

4 Summarizing

5 Inferring

5.1 Sentiment (positive/negative)

推测评价的态度,且仅回答一个单词

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)

【吴恩达推荐】《ChatGPT Prompt Engineering for Developers》- 知识点目录_第8张图片

5.2 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)

【吴恩达推荐】《ChatGPT Prompt Engineering for Developers》- 知识点目录_第9张图片

5.3 【Note】 举例说明说明zero-shot

【吴恩达推荐】《ChatGPT Prompt Engineering for Developers》- 知识点目录_第10张图片

Andrew Ng: In machine learning, this is sometimes called a zero-shot learning algorithm, because we didn’t give it any training data that was labeled. So, that’s zero-shot.

5.3 【Note】 使用Redlines显示文字差异

【吴恩达推荐】《ChatGPT Prompt Engineering for Developers》- 知识点目录_第11张图片

6 Chatbot

【吴恩达推荐】《ChatGPT Prompt Engineering for Developers》- 知识点目录_第12张图片

6.1 【Note】gpt-3.5-turbo-api的数学能力处于小学水平,仍无法正确计算多个浮点数的加法

模型设置:
【吴恩达推荐】《ChatGPT Prompt Engineering for Developers》- 知识点目录_第13张图片
订单计算:

Sure, here's a JSON summary of the order:
{
  "pizza": [
    {
      "type": "pepperoni",
      "size": "large",
      "price": 12.95
    },
    {
      "type": "cheese",
      "size": "medium",
      "price": 9.25
    }
  ],
  "toppings": [
    {
      "type": "extra cheese",
      "price": 2.00
    },
    {
      "type": "mushrooms",
      "price": 1.50
    }
  ],
  "drinks": [
    {
      "type": "coke",
      "size": "large",
      "price": 3.00
    },
    {
      "type": "sprite",
      "size": "small",
      "price": 2.00
    }
  ],
  "sides": [
    {
      "type": "fries",
      "size": "large",
      "price": 4.50
    }
  ],
  "total_price": 38.20
}

计算错误!实际上应该是35.20美元。

你可能感兴趣的:(人工智能,ChatGPT)