您现在的位置是:首页 >技术杂谈 >【吴恩达推荐】《ChatGPT Prompt Engineering for Developers》- 知识点目录网站首页技术杂谈

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

songyuc 2023-07-08 00:00:03
简介【吴恩达推荐】《ChatGPT Prompt Engineering for Developers》- 知识点目录

《ChatGPT Prompt Engineering for Developers》

1 Introduction

2 Guidelines

Principle 1: Write clear and specific instructions

在这里插入图片描述

Tactic 1: Use delimiters

在这里插入图片描述

Tactic 3: “If-statement”

  • Check whether conditions are satisfied
  • Check assumptions required to do the task
    在这里插入图片描述

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

[Note]: “Content after prompt”

看视频里面小姐姐演示的示例中,一般都是先输入提示,然后再给出阅读材料:
在这里插入图片描述

Principle 2: Give the model time to “think

Tactic 1: Specify the steps required to complete a task

在这里插入图片描述

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

在这里插入图片描述

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 <div> element.

Technical specifications: ```{fact_sheet_chair}```
"""

response = get_completion(prompt)
print(response)

产生的表格效果

在这里插入图片描述

5 Inferring

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)

在这里插入图片描述

风语者!平时喜欢研究各种技术,目前在从事后端开发工作,热爱生活、热爱工作。