吴恩达 ChatGPT Prompt Engineering for Developers 系列课程笔记--03 Iterative

03 Iterative

本节主要通过代码来讲解如何在迭代中找到合适的prompt。对于初学者来说,第一次使用Prompt不一定得到语气的结果,开发者可以采用下述流程进行迭代优化:

  • 给出清晰、具体的指令
  • 如果结果不正确,分析原因
  • 调整prompt
  • 重复上述过程直至得到想要的结果
    iterative

1) 示例

比如你想要模型为某产品的零售网站写一段描述,给出的指令为

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}```
"""

其中fact_sheet_chair为网站的技术说明书。

  • Issue1: 如果模型给出的结果特别长。这时你可以在指令中增加Use at most 50 words或者Use at most 3 sentences或者Use at most 200 characters来限制输出的长度。模型给出了52个token的句子,效果还可以。
  • Issue2: 如果此时内容对技术细节表述不够精确,这时你可以增加The description is intended for furniture retailers, so should be technical in nature and focus on the materials the product is constructed from.令内容聚焦于特定内容。
  • Issue3: 你希望模型增加一些维度的信息,此时你可以增加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.指定模型给出其他需要的信息并结构化输出HTML。你可以通过display(HTML(response))将html转化为table。

最终你得到的结构化表格为
table

上一篇:吴恩达 ChatGPT Prompt Engineering for Developers 系列课程笔记–02 Guidelines

下一篇:吴恩达 ChatGPT Prompt Engineering for Developers 系列课程笔记–04 Summarizing

deeplearning.ai 原课程地址

课程中文翻译地址

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值