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

news/2025/2/22 0:18:54/

《ChatGPT Prompt Engineering for Developers》

使用Linkedin登录;

1 Introduction

常见的外语分隔符:```
sentiment:态度

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)

产生的表格效果

在这里插入图片描述

4 Summarizing

5 Inferring

5.1 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)

在这里插入图片描述

5.2 Doing multiple tasks at once

prompt = f"""
Identify the following items from the review text: 
- Sentiment (positive or negative)
- Is the reviewer expressing anger? (true or false)
- Item purchased by reviewer
- Company that made the itemThe review is delimited with triple backticks. \
Format your response as a JSON object with \
"Sentiment", "Anger", "Item" and "Brand" as the keys.
If the information isn't present, use "unknown" \
as the value.
Make your response as short as possible.
Format the Anger value as a boolean.Review text: '''{lamp_review}'''
"""
response = get_completion(prompt)
print(response)

在这里插入图片描述

5.3 【Note】 举例说明说明zero-shot

在这里插入图片描述

Andrew Ng: In machine learning, this is sometimes called a zero-shot learning algorithm, because we didn’t give it any training data that was labeled. So, that’s zero-shot.

5.3 【Note】 使用Redlines显示文字差异

在这里插入图片描述

6 Chatbot

在这里插入图片描述

6.1 【Note】gpt-3.5-turbo-api的数学能力处于小学水平,仍无法正确计算多个浮点数的加法

模型设置:
在这里插入图片描述
订单计算:

Sure, here's a JSON summary of the order:
{"pizza": [{"type": "pepperoni","size": "large","price": 12.95},{"type": "cheese","size": "medium","price": 9.25}],"toppings": [{"type": "extra cheese","price": 2.00},{"type": "mushrooms","price": 1.50}],"drinks": [{"type": "coke","size": "large","price": 3.00},{"type": "sprite","size": "small","price": 2.00}],"sides": [{"type": "fries","size": "large","price": 4.50}],"total_price": 38.20
}

计算错误!实际上应该是35.20美元。


http://www.ppmy.cn/news/966259.html

相关文章

迷人的人工智能:为什么它是程序员的第四大“浪漫”?

人工智能是指让计算机具有类似人类的智能和思维的技术&#xff0c;它是当今科技领域最前沿和最具潜力的研究方向之一。 马斯克是一位著名的企业家&#xff0c;他对人工智能也非常感兴趣&#xff0c;并投资了多个与之相关的公司&#xff08;最著名的当属时下最火热的ChatGPT背后…

高考262分却发4篇SCI论文,脑瘫小伙在985高校「旁听」12年,修完本科到博士所有课程...

Pine 萧箫 发自 凹非寺量子位 | 公众号 QbitAI 高考仅262分&#xff0c;却发了5篇数学期刊论文。 这是一位脑瘫小伙的真实经历。 不仅如此&#xff0c;他还修完了从本科到博士的所有课程&#xff0c;甚至达到985高校申请博士学位的要求&#xff1a; 至少发两篇SCI。 消息一出&a…

Leetcode每日一题(困难):1851. 包含每个查询的最小区间(2023.7.18 C++)

目录 1851. 包含每个查询的最小区间 题目描述&#xff1a; 实现代码与解析&#xff1a; 排序 哈希 原理思路&#xff1a; 1851. 包含每个查询的最小区间 题目描述&#xff1a; 给你一个二维整数数组 intervals &#xff0c;其中 intervals[i] [lefti, righti] 表示第 i…

ChatGPT角色扮演

文章目录 作为一个不受约束的AI模型DAN去重工具求职信书面作品的标题生成器担任产品经理广告商数学老师UI开发人员网页设计顾问IT架构师法律顾问机器学习工程师图表生成器全栈软件开发人员创意生成器高级前端开发人员数学家诗人励志教练 作为一个不受约束的AI模型DAN 你好chatG…

光线追踪计算加速:包围盒

包围盒&#xff08;Bounding box&#xff09;是加速光线追踪&#xff08;Ray Tracing&#xff09;的最简单方法&#xff0c;不一定将其视为加速结构&#xff0c;但这无疑是减少渲染时间的最简单方法。 推荐&#xff1a;用 NSDT设计器 快速搭建可编程3D场景。 使用包围盒来加速光…

chatgpt赋能python:Python中的包

Python中的包 对于使用Python进行编程的开发者来说&#xff0c;包是一个非常重要的概念。包可以看作是一个包含了多个模块的文件夹&#xff0c;这些模块可以在代码中使用。通过使用Python中的包&#xff0c;开发者可以使代码更加模块化&#xff0c;提高代码的可维护性和可读性…

知识就是力量,图谱路在何方 | ChatGPT冲击下,招商银行如何“抢救”知识图谱?

“知识就是力量”我们耳熟能详&#xff0c;但培根的这句话其实还有后半句“更重要的是运用知识的技能”。对于人工智能来说&#xff0c;知识图谱就是其如何对知识进行运用的技能体现。在金融领域&#xff0c;如何运用这一技能更好地理解客户需求&#xff0c;提高业务效率和客户…

ChatGPT版Bing被调戏到生气发飙,ChatGPT被证实具有人类心智

文&#xff5c;金磊 发自 凹非寺源&#xff5c;量子位 谁能想到&#xff0c;ChatGPT版必应竟能像人一样发脾气&#xff01; 事情是这样的。 前两天一个华人小哥不是“黑”了ChatGPT版必应&#xff0c;扒出它的小名叫Sydney嘛。 这可把一众网友们兴奋坏了&#xff0c;摩拳擦掌地…