ChatGPT提示词工程(三):Summarizing概括总结

目录

  • 一、说明
  • 二、安装环境
  • 三、概括总结(Summarizing)
    • 1. 简单地概括总结,只有字数限制
    • 2. 概括总结需要关注的某些点
  • 四、用“提取”代替“总结”(Try "extract" instead of "summarize")
  • 五、概括总结多个产品评价(Summarize multiple product reviews)

一、说明

这是吴恩达 《ChatGPT Prompt Engineering for Developers》 的课程笔记系列。
本文是第四讲的内容:Summarizing

二、安装环境

参考: ChatGPT提示词工程(一):Guidelines准则 的第二节

三、概括总结(Summarizing)

1. 简单地概括总结,只有字数限制

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.
"""
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. Review: ```{prod_review}```
"""response = get_completion(prompt)
print(response)

Prompt中任务是要求模型总结prod_review,要求30字以内,运行结果:
在这里插入图片描述

2. 概括总结需要关注的某些点

prompt = f"""
Your task is to generate a short summary of a product \
review from an ecommerce site to give feedback to the \
Shipping deparmtment. Summarize the review below, delimited by triple 
backticks, in at most 30 words, and focusing on any aspects \
that mention shipping and delivery of the product. Review: ```{prod_review}```
"""response = get_completion(prompt)
print(response)

代码中,要求模型关注商品的运输和交付方面,运行结果:
在这里插入图片描述

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)

代码中,要求模型关注商品的价格和价值,运行结果:
在这里插入图片描述
注意:模型给出的结果中,除了你所关注的方面,还会给出一些无关的内容,这需要在实际的运用中由你自己决定是否有用。
https://blog.csdn.net/Jay_Xio/article/details/130456580



四、用“提取”代替“总结”(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)

代码中,要求模型提取相关信息反馈给商品运输部门,模型给出的结果简单明了,只有商品提前一天到达的信息,结果如下:
在这里插入图片描述
https://blog.csdn.net/Jay_Xio/article/details/130456580



五、概括总结多个产品评价(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")

代码中, 有四个产品评价,需要模型进行总结,代码运行模型分别给出了四个总结结果:

在这里插入图片描述

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

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

相关文章

微信小程序自定义tabbar,custom-tab-bar

背景: 由于需要按权限配置底部tabbar,所以需要用到自定义,微信官方文档自定义 tabBar 1. 配置信息 在 app.json 中的 tabBar 项指定 custom 字段,同时其余 tabBar 相关配置也补充完整 {"tabBar": {"custom": …

微信小程序开发 一 tabbar图标和颜色

前期准备 :注册,填材料,验证等等: https://mp.weixin.qq.com1.浏览一遍简易教程,下载相应的开发工具 写一个小例子 点击左侧的 “编辑”-》点击右侧代码里的 app.json 修改为 {"pages":["pages/fig…

as微信界面设计

一、内容 实操实现APP门户界面框架设计&#xff0c;至少包含4个tab页&#xff0c;能实现tab页之间的点击切换 二、技术 使用布局&#xff08;layouts&#xff09;和分段&#xff08;fragment&#xff09;&#xff0c;对控件进行点击监听 三、xml代码 top.xml <?xml ve…

将iconfont图标引入到vant的Tabbar标签栏里边

vant的Tabbar标签栏https://youzan.github.io/vant/#/zh-CN/tabbar 在app开发中&#xff0c;这个必不可少&#xff0c;上一张讲了怎么引入iconfont图标&#xff0c;现在就将iconfont图标引入到tabbar标签栏里边&#xff0c;看着vant提供的图标&#xff0c;必将有点丑啊23333&am…

微信小程序自定义tabBar以及图标-使用vant-weapp

小程序整合vant weapp可以看《微信小程序vant weapp安装与使用》 微信官方文档有介绍自定义tabBar 1、在小程序根目录下创建custom-tab-bar文件夹&#xff0c;并创建以下文件。&#xff08;这个是作为入口文件的&#xff09; custom-tab-bar/index.js custom-tab-bar/index.…

WeTab新标签页:浏览器主页就可以直接使用的Chat GPT

我一直觉得&#xff0c;如果能在打开浏览器的时候就能使用chatgpt&#xff0c;那可以说是再方便不过了。 刚好前段时间我发现我正在使用的WeTab新标签页刚好有了这个新功能&#xff0c;可以在新标签页上直接用gpt。 因为一些原因&#xff0c;很多人都被注册chatGPT的繁琐步骤劝…

Chat GPT使用体验,现在不会还有人没用过GPT吧?

“ChatGPT 好得吓人&#xff0c;我们离强大到危险的人工智能不远了”。 这是我们最近听到不少的一些声音&#xff0c;甚至有许多美丽国的大佬&#xff0c;联名要求停止gpt5的开发。 然而&#xff0c;尽管 ChatGPT 确实是一种相当出色的模型&#xff0c;但它也有其限制和局限性…

用后即弃的人造人

即使各种鼓励政策不断被使出&#xff0c;很多发达国家的女性&#xff0c;也不大愿意生孩子了。少子化是现代化、工业化的附赠品&#xff0c;这一点无可回避。 所以很多人都很期待用科技来造人。埃隆马斯克&#xff08;Elon Musk&#xff09;等人提出的“人造子宫”方案&#xf…

Android程序员惨遭社会毒打,如何快准狠的应对下次危机?

一、程序员现状 今年年初&#xff0c;我同行朋友的小公司辞退了10多个程序员。 近3个月过去了&#xff0c;大概一半的人找不到合适工作。大家聊起时正在感慨这两年好多行业都不景气&#xff0c;朋友说&#xff0c;他的前同事们不少非科班出身&#xff0c;半路参加培训机构后就…

波士顿动力新年炸场!人形机器人飞身转投工具包,最后体操式落地把人类给整不会了...

杨净 丰色 发自 凹非寺量子位 | 公众号 QbitAI 波士顿动力Atlas&#xff0c;又来整活炸场了&#xff01; 不是跑酷不是跳舞&#xff0c;而是去工地老实上班当助手&#xff0c;结果把人类给整不会了。 当高架上工人需要工具包&#xff0c;Atlas二话不说完成搭桥、爬楼等一系列动…

“Google 之母”诞生 | 历史上的今天

整理 | 王启隆 透过「历史上的今天」&#xff0c;从过去看未来&#xff0c;从现在亦可以改变未来。 今天是 2023 年 7 月 5 日&#xff0c;在 1994 年的今天&#xff0c;在半导体大战中&#xff0c;英特尔宣布降价以阻止竞争对手&#xff1b;当天&#xff0c;英特尔公司宣布了其…

重磅!微软推出HuggingGPT:所有HuggingFace的模型都可以被ChatGPT随意调用!

编&#xff5c;桃子 Britta 源&#xff5c;新智元 「贾维斯」已来&#xff01;微软亚研院和浙大推出了一个大模型协作系统HuggingGPT&#xff0c;让ChatGPT协调HF社区模型&#xff0c;处理各种多模态任务能力超强。 ChatGPT引爆的AI热潮也「烧到了」金融圈。 近来&#xff0c;彭…

chatGPT联结hugging face了

文章目录 ChatGPT自己选模型&#xff01;浙大微软亚研院新论文&#xff0c;HuggingGPT项目开源HuggingGPT搭桥四步工作流程多模态能力&#xff0c;有了 ChatGPT自己选模型&#xff01;浙大微软亚研院新论文&#xff0c;HuggingGPT项目开源 原文链接&#xff1a;https://mbd.ba…

答题小程序团队多人pk答题赛功能详解

针对目前答题小程序的趣味性、参与性特此开发了答题小程序团队多人赛&#xff0c;具体介绍如下&#xff1a; 一、 邀请制团队多人赛 2V2模式&#xff1a;2V2模式顾名思义&#xff0c;即2个人对另外的2个人进行团队pk答题。操作流程为&#xff1a;进入团队赛邀请制&#xff0c;邀…

活动星投票技能创意大赛网络评选微信的投票方式线上免费投票

“技能创意大赛”网络评选投票_建立投票链接_作品投票小程序_扫码投票制作方法 现在来说&#xff0c;公司、企业、学校更多的想借助短视频推广自己。 通过微信投票小程序&#xff0c;网友们就可以通过手机拍视频上传视频参加活动&#xff0c;而短视频微信投票评选活动既可以给用…

【2018国赛线上比赛】知识问答题真题演练第一波

1、操作系统为了防止应用程序在不可执行区域中运行代码提供的解决方案是什么&#xff1f;( A ) A、数据执行保护 B、地址随机化保护 C、只读保护 D、访问违例异常 2、Stack Canary 的作用是什么&#xff1f;( A ) A、缓解栈越界写入 B、缓解栈越界读取 C、缓解堆越界写入 D、缓…

基于闻达(wenda+chatGLM-6B),构建自己的知识库小助手

目录 安装miniconda 拉取仓库 使用内置python 安装依赖 上传模型 克隆及下载 text2vec-large-chinese 修改配置 上传知识库&#xff08;txt文件&#xff09; 处理txt数据 启动服务 测试 ChatGLM-6B是清华团队智谱AI开发的&#xff0c;一个开源的、支持中英双语的对话…

用离散数学知识对AI最难替代的职业进行数学建模,推导证明出最难被AI替代的职业是什么

摘要&#xff1a; 本文基于离散数学的知识&#xff0c;对人类智力劳动的职业进行数学建模&#xff0c;并推导出最难被AI替代的职业。通过对职业的分析&#xff0c;本文认为&#xff0c;应该运用离散数学中的图论知识对AI替代各种人类职业的难易进行数学建模&#xff0c;从中寻找…

与2017年度两位图灵奖得主的虚拟对话

【新一届图灵奖即将揭晓&#xff0c;在此与大家分享撰写的2017年度两位图灵奖得主的故事。本文于2018年3月28日完稿&#xff0c;发表于《中国计算机学会通讯》2018年第4期。】 2017年度的计算机领域最高奖“图灵奖”终于揭晓——斯坦福大学的约翰●轩尼诗&#xff08;John Henn…

这把小刀怎么用——详解Knife4j框架

目录 介绍 使用步骤 1.在maven中添加依赖 2.添加其配置类&#xff0c;可以放在项目其他框架的配置类包中 3.application.properties中添加配置 介绍 Knife4j是为Java MVC框架集成Swagger生成在线Api文档的增强解决方案,其前身是swagger-bootstrap-ui&#xff0c;此框架还有调…