策略:明确完成任务所需的步骤
接下来的任务我想让GPT处理一段文本,且需要完成一下一系列任务:
1)将文本总结成摘要
2)将摘要翻译成英文
3)提取英文摘要中的名字
4)将翻译的英文摘要和提取的名字以JSON格式输出
每一步任务都是紧密相关的,且都是依赖上一步任务的结果,我们jupyter实战演练下:
GPT的任务执行结果:
1 - 兄妹杰克和吉尔在山顶井中取水的探险中遭遇不幸,但他们的冒险精神仍然没有减弱,继续充满喜悦地探索着。 2 - Jack and Jill had an unfortunate accident while exploring a well on a mountaintop, but their adventurous spirit remained undiminished as they continued to explore with joy. 3 - Jack, Jill 4 - {"eng_summary": "Jack and Jill had an unfortunate accident while exploring a well on a mountaintop, but their adventurous spirit remained undiminished as they continued to explore with joy.", "num_names": 2}
可见执行结果非常精确!我们只需设置好任务规则,GPT就可以依据自己的‘思考’结果逐步往下执行!
我们还可以设置多种输出格式,还是以上面文本为例:
我想将以上四项任务分别以不同格式输出:
指定格式的输出如下:
摘要: 杰克和吉尔在山顶井中取水的探险中遭遇不幸,但他们的冒险精神没有减弱,继续探索着。 翻译: Jack and Jill had an unfortunate accident while exploring the well on the mountaintop, but their adventurous spirit remained strong as they continued to explore with joy. 名字: Jack, Jill JSON: {"eng_summary": "Jack and Jill had an unfortunate accident while exploring the well on the mountaintop, but their adventurous spirit remained strong as they continued to explore with joy.", "num_names": 2}
依然理解的非常到位,yyds~~
限时福利:大家如果没有api_key或者本机能访问openAI的URL,可以拉取3位好友关注公众号:奇点涌现,公众号已对接ChatGPT,发消息即可体验。文章来源:https://www.toymoban.com/news/detail-484276.html
关注后加作者微信:dyrslds,发送关注截图确认,作者发送教程中使用的api_key及访问openAI的URL,只限前60名,先到先得!文章来源地址https://www.toymoban.com/news/detail-484276.html
到了这里,关于吴恩达提示工程实战演练 - 如何引导GPT主动思考的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!