吴恩达 Chatgpt prompt 工程--2.Iterative-prompt

迭代分析和完善prompts,以从产品概况表中生成营销副本。

Setup

import openai
import osfrom dotenv import load_dotenv, find_dotenv
_ = load_dotenv(find_dotenv()) # read local .env fileopenai.api_key  = os.getenv('OPENAI_API_KEY')
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"]

从产品概况表生成营销产品描述

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 foamCOUNTRY 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)
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 between plastic back and front upholstery (SWC-100) or full upholstery (SWC-110) in 10 fabric and 6 leather options. The base finish options are stainless steel, matte black, gloss white, or chrome, and the chair is available with or without armrests. Constructed with a 5-wheel plastic coated aluminum base and pneumatic chair adjust for easy raise/lower action, this chair is both durable and comfortable. The dimensions are as follows: 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. Customize your chair even further with soft or hard-floor caster options, two choices of seat foam densities (medium or high), and armless or 8 position PU armrests. Made with high-quality materials, including a cast aluminum shell with modified nylon PA6/PA66 coating and HD36 foam seat, this chair is both stylish and functional. Plus, it's qualified for contract use. Experience the Italian craftsmanship and design with our mid-century inspired office chair.
问题一:输出太长了
  • 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.Technical specifications: ```{fact_sheet_chair}```
"""
response = get_completion(prompt)
print(response)
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(' '))
# 55
问题二 :文本聚焦于不恰当的细节
  • 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)
Introducing our mid-century inspired office chair, perfect for both home and business settings. With a range of shell colors and base finishes, including stainless steel and matte black, this chair is available with or without armrests. The 5-wheel plastic coated aluminum base and pneumatic chair adjust make it easy to move and adjust to your desired height. Made with high-quality materials, including a cast aluminum shell and HD36 foam seat, this chair is built to last.
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.Use at most 50 words.Technical specifications: ```{fact_sheet_chair}```
"""
response = get_completion(prompt)
print(response)
Introducing our mid-century inspired office chair, perfect for home or business settings. With a range of shell colors and base finishes, and the option of plastic or full upholstery, this chair is both stylish and comfortable. Constructed with a 5-wheel plastic coated aluminum base and pneumatic chair adjust, it's also practical. Available with or without armrests and suitable for contract use. Product ID: SWC-100, SWC-110.
问题三:描述需要尺寸表
  • 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 <div> element.Technical specifications: ```{fact_sheet_chair}```
"""response = get_completion(prompt)
print(response)
<div>
<h2>Mid-Century Inspired Office Chair</h2>
<p>Introducing our mid-century inspired office chair, part of a beautiful family of office furniture that includes filing cabinets, desks, bookcases, meeting tables, and more. This chair is available in several options of shell color and base finishes, allowing you to customize it to your liking. You can choose between plastic back and front upholstery or full upholstery in 10 fabric and 6 leather options. The base finish options are stainless steel, matte black, gloss white, or chrome. The chair is also available with or without armrests, making it suitable for both home and business settings. Plus, it's qualified for contract use, so you can trust its durability and quality.</p>
<h3>Construction</h3>
<p>The chair features a 5-wheel plastic coated aluminum base and a pneumatic chair adjust for easy raise/lower action. You can 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 chair is also available with armless or 8 position PU armrests.</p>
<h3>Materials</h3>
<p>The shell base glider is made of cast aluminum with modified nylon PA6/PA66 coating, and the shell thickness is 10 mm. The seat is made of HD36 foam, ensuring comfort and support.</p>
<h3>Product Dimensions</h3>
<table><tr><td>Width</td><td>53 cm | 20.87"</td></tr><tr><td>Depth</td><td>51 cm | 20.08"</td></tr><tr><td>Height</td><td>80 cm | 31.50"</td></tr><tr><td>Seat Height</td><td>44 cm | 17.32"</td></tr><tr><td>Seat Depth</td><td>41 cm | 16.14"</td></tr>
</table>
<h3>Product ID</h3>
<p>SWC-100, SWC-110</p>
</div>

加载Python库以查看HTML

from IPython.display import display, HTML
display(HTML(response))

在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/44497.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

吴恩达 ChatGPT Prompt Engineering for Developers 系列课程笔记--07 Expanding

07 Expanding 本节示例如何用ChatGPT生成一封电子邮件的回复。 1) 定制化情绪 给定客户评论&#xff0c;我们根据评论内容和情绪产生定制的回复。下面是给定情感&#xff08;positive/negative&#xff09;&#xff0c;让ChatGPT产生相应回复的prompt。 """…

吴恩达ChatGPT课爆火:AI放弃了倒写单词,但理解了整个世界

明敏 杨净 发自 凹非寺量子位 | 公众号 QbitAI 没想到时至今日&#xff0c;ChatGPT竟还会犯低级错误&#xff1f; 吴恩达大神最新开课就指出来了&#xff1a; ChatGPT不会反转单词&#xff01; 比如让它反转下lollipop这个词&#xff0c;输出是pilollol&#xff0c;完全混乱。 …

吴恩达ChatGPT《LangChain for LLM Application Development》笔记

基于 LangChain 的 LLM 应用开发 1. 介绍 现在&#xff0c;使用 Prompt 可以快速开发一个应用程序&#xff0c;但是一个应用程序可能需要多次写Prompt&#xff0c;并对 LLM 的输出结果进行解析。因此&#xff0c;需要编写很多胶水代码。 Harrison Chase 创建的 LangChain 框…

国际海运出口的操作流程是怎样的?

国际海运运输因为方便快捷以及运费低等特点&#xff0c;一直以来是大多数外贸企业出口货物物流运输的首选&#xff0c;然而新进入外贸行业的朋友们&#xff0c;对于海运出口流程还不是很了解&#xff0c;今天箱讯小编就为大家来介绍下。 海运出口操作流程如下&#xff1a; 1、…

用Python赚钱的方法有哪些?

很多人想知道用Python赚钱的方法有哪些&#xff1f;Python很容易使用&#xff0c;应用性较强。可以通过使用Python开发小程序、抓取数据、游戏开发、兼职编程老师&#xff0c;发展副业的方式来赚钱。 用Python赚钱的方法&#xff1a; 1、某宝搜python程序      可以到某宝…

学python可以做什么兼职-Python兼职收入过万?用Python做项目真的这么赚钱吗?

今天给大家分享一下2位前辈业余接兼职做的一些Python项目。我在这里想说&#xff0c;无论你是自学还是进培训班&#xff0c;只要把Python学好&#xff0c;钱自然而来。 问&#xff1a;请问用Python可以接哪些兼职的活赚钱? 1兼职费用足够学费生活费 恰巧上学期间接过一些外…

Midjourney指令操作、promt框架、参数设置教程

引言&#xff1a;基于Chatgpt的应用如雨后春笋&#xff0c;这波浪潮正当时。最近在摸索图片生成有价值的应用场景&#xff0c;使用过程中整理了一些指令秘籍&#xff0c;一同分享出来。 1、原理 Midjourney的人工智能绘画技术基于GPT-3.5模型&#xff0c;使用了先进的神经网络…

Python 如何赚钱?学会我交给你的Python赚钱大法,就算是大学生,月入1W外快不在话下。

现在学python的人越来越多了&#xff0c;都说学python赚的钱多&#xff0c;那么问题来了&#xff0c;就是我学完Python赚不到钱怎么办? 或者说找不到Python赚外快的平台或方式&#xff0c;今天小编我分享我的Python赚钱大法&#xff0c;学完月入1W外快不在话下&#xff01; …

实现财务自由 之 A 股上市公司的年报(年度财报)查阅查看、下载地址、以及下载的方法

实现财务自由 之 A 股上市公司的年报&#xff08;年度财报&#xff09;查阅查看、下载地址、以及下载的方法 目录 实现财务自由 之 A 股上市公司的年报&#xff08;年度财报&#xff09;查阅查看、下载地址、以及下载的方法 A 股上市公司年报&#xff0c;下载具体方法 1、打…

在 AI 上训练 AI:ChatGPT 上训练另一种机器学习模型

ChatGPT 可以像 Linux 终端一样运行&#xff0c;并在给出以下提示时返回执行结果。下面我来带大家操作起来。 文章目录 终端操作训练机器学习模型镜像演示 终端操作 输入&#xff1a;I want you to act as a Linux terminal. I will type commands and you will reply with wh…

【免费分享】chatgpt打造属于自己的AI口语私教,保姆级教程

随着人工智能技术的不断发展&#xff0c;AI口语学习已经成为了一种趋势。而如何打造一款自己的AI口语私教工具呢&#xff1f;本文将为大家介绍利用chatgpt api、百度翻译、腾讯智聆api、百度语音等技术&#xff0c;打造一款AI口语私教工具的步骤。 一、利用到的技术 1、chatg…

一分钟教会你ai文本工具如何使用

今天我要给大家推荐一些ai文本生成器&#xff01;你知道吗&#xff0c;ai文本生成器是一个超厉害的东西&#xff0c;它可以帮助我们创作出令人惊叹的文章、故事和甚至是诗歌。不管你是一名作家、学生还是只是想要表达自己的创意&#xff0c;这些工具都会是你的绝佳助手&#xf…

巴比特 | 元宇宙每日必读:多个大模型官宣,马斯克、姚期智、杨立昆等共话AIGC,世界人工智能大会有哪些看点?...

摘要&#xff1a;据钛媒体报道&#xff0c;7月6日&#xff0c;2023世界人工智能大会&#xff08;WAIC&#xff09;在上海世博中心正式拉开帷幕。特斯拉CEO埃隆马斯克&#xff08;Elon Musk&#xff09;&#xff0c;华为轮值董事长胡厚崑&#xff0c;微软全球资深副总裁、微软大…

对话算想未来创始人赵亚雄:希望做“为中国 AI 经济而生的 AWS”

本文约9000字&#xff0c;建议阅读10分钟“全球最聪明的人都在大模型创业&#xff0c;没人会禁受得住它的诱惑。” ChatGPT爆火&#xff0c;引得全世界为之疯狂&#xff0c;恍惚中一夜之间&#xff0c;人人都在讨论ChatGPT&#xff0c;所有大佬和资本纷纷涌进大模型。 上一次如…

真有意思,AI高引论文排行榜:OpenAI和DeepMind未进前十,旷视排第二?

文&#xff5c;丰色 发自 凹非寺源&#xff5c;量子位 哪些机构或国家&#xff08;地区&#xff09;发表的AI研究是最具影响力的&#xff1f; 为了弄清这个问题&#xff0c;美国Zeta Alpha平台统计了2020-2022三年之间全世界引用次数前100的AI论文&#xff0c;得出了一些很有意…

【SaaS播客】onboard20. 生成式AI AIGC:硅谷AI大牛、投资人、创业者眼里的机会与挑战

近期IT领域最火热的话题就是AIGC了&#xff0c;可以说是真正出圈了&#xff0c;这个词貌似是百度大力推广的&#xff1b;国际上用得更多的是Generative生成式AI。最近的热点是“真”智能聊天的产品chatGPT。我认为对上层产品而言最关键的是这2个里程碑: 20年中OpenAI推出GPT-3…

新华三眼中的AI天路

ChatGPT的火爆&#xff0c;在全球范围内掀起了新一轮的AI风暴。如今&#xff0c;各行各业都在讨论AI&#xff0c;各个国家都在密集进行新一轮的AI基础设施建设与技术投入。 但眼前的盛景并非突然到来&#xff0c;就拿这一轮大模型热潮来说&#xff0c;谷歌早在2018年底就发布了…

南京标志设计-logo设计(品牌形象核心部分)

标志设计&#xff0c;是表明事物特征的记号——它以单纯、显著、易识别的物象、图形或文字符号为直观语言&#xff0c;除标示什么、代替什么之外&#xff0c;还具有表达意义、情感和指令行动等作用。标志&#xff0c;作为人类直观联系的特殊方式&#xff0c;不但在社会活动与生…

Logo设计

Inkscape设计Logo 我根据自己名字的缩写&#xff08;XY&#xff09;设计了一个LOGO 1、添加文本 &#xff08;1&#xff09;单击左边工具“A“&#xff0c;在图纸上添加文本框&#xff0c;键盘输入“X”&#xff0c;在上方菜单栏调整自己想要的文本字体和大小&#xff08;字…

愉快的logo设计

Description K理事长正在思考日本信息学奥林匹克竞赛选手的应援道具的logo问题。某天&#xff0c;K理事长突发奇想&#xff0c;想要设计一个用’J’&#xff0c;’O’&#xff0c;’I’三种文字环形排列的logo&#xff0c;意为希望选手能从JOI中收获快乐的意思。 (注&#xf…