当前位置: 首页 > news >正文

openAI官方prompt技巧(一)

1. 使用最新的模型

2. 将指令放在提示词的开头,并使用 ### 或 """ 来分隔指令和上下文,例如

错误示范❌
将下面的文本总结为一个要点列表,列出最重要的内容。
Summarize the text below as a bullet point list of the most important points.{text input here}正确示范✔
Summarize the text below as a bullet point list of the most important points.Text: """
{text input here}
"""

3. 明确说明上下文、结果、长度、格式、风格等

错误示范❌
Write a poem about OpenAI. 正确示范✔
写一首简短的鼓舞人心的诗,主题是 OpenAI 最近推出的 DALL-E 产品(DALL-E 是一个文本转图像的机器学习模型),以 {著名诗人} 的风格进行创作。
Write a short inspiring poem about OpenAI, focusing on the recent DALL-E product launch (DALL-E is a text to image ML model) in the style of a {famous poet}

4. 通过示例明确说明所需的输出格式

错误示范❌
提取下面文本中提到的实体。提取以下四种实体类型:公司名称、人物名称、特定话题和主题。
Extract the entities mentioned in the text below. Extract the following 4 entity types: company names, people names, specific topics and themes.Text: {text}正确示范✔
提取下面文本中提到的重要实体。首先提取所有公司名称,然后提取所有人物名称,再提取符合内容的特定话题,最后提取一般性的主题。所需格式:
公司名称:<以逗号分隔的公司名称列表>
人物名称:-||-
特定话题:-||-
一般主题:-||-文本:{text}
Extract the important entities mentioned in the text below. First extract all company names, then extract all people names, then extract specific topics which fit the content and finally extract general overarching themesDesired format:
Company names: <comma_separated_list_of_company_names>
People names: -||-
Specific topics: -||-
General themes: -||-Text: {text}

5. 先尝试零样本(Zero-shot),然后尝试少样本(Few-shot),如果都不起作用,再进行微调(Fine-tune)

Zero-shot
Extract keywords from the below text.Text: {text}Keywords:Few-shot
从以下对应的文本中提取关键词。
Extract keywords from the corresponding texts below.文本 1: Stripe 提供 API,Web 开发人员可以使用这些 API 将支付处理集成到其网站和移动应用程序中。
关键词 1: Stripe、支付处理、API、Web 开发人员、网站、移动应用程序
Text 1: Stripe provides APIs that web developers can use to integrate payment processing into their websites and mobile applications.
Keywords 1: Stripe, payment processing, APIs, web developers, websites, mobile applications
##文本 2: OpenAI 训练了最前沿的语言模型,这些模型非常擅长理解和生成文本。我们的 API 提供了对这些模型的访问,并可用于几乎所有涉及语言处理的任务。
关键词 2: OpenAI、语言模型、文本处理、API
Text 2: OpenAI has trained cutting-edge language models that are very good at understanding and generating text. Our API provides access to these models and can be used to solve virtually any task that involves processing language.
Keywords 2: OpenAI, language models, text processing, API.
##
Text 3: {text}
Keywords 3:

6. 减少“华而不实”和不精确的描述

错误示范❌
此产品的描述应尽量简短,仅需几句话,不宜过多。
The description for this product should be fairly short, a few sentences only, and not too much more.正确示范✔
使用一个包含 3 到 5 句话的段落来描述此产品。
Use a 3 to 5 sentence paragraph to describe this product.

7. 直接说明该做什么,而不是不该做什么

错误示范❌
以下是代理(Agent)与客户(Customer)之间的对话。不要询问用户名或密码。不要重复内容。客户: 我无法登录我的账户。
代理:
The following is a conversation between an Agent and a Customer. DO NOT ASK USERNAME OR PASSWORD. DO NOT REPEAT.Customer: I can’t log in to my account.
Agent:正确示范✔
以下是代理(Agent)与客户(Customer)之间的对话。代理应尝试诊断问题并提供解决方案,同时避免询问任何与个人身份信息(PII)相关的问题。
不要询问 PII(如用户名或密码),而应引导用户访问帮助文章:www.samplewebsite.com/help/faq客户: 我无法登录我的账户。
代理:
The following is a conversation between an Agent and a Customer. The agent will attempt to diagnose the problem and suggest a solution, whilst refraining from asking any questions related to PII. Instead of asking for PII, such as username or password, refer the user to the help article www.samplewebsite.com/help/faqCustomer: I can’t log in to my account.
Agent:

8. 代码生成相关 - 使用“引导词”引导模型遵循特定模式

错误示范❌
编写一个简单的 Python 函数
1. 询问用户输入一个英里数
2. 将英里转换为公里
Write a simple python function that
1. Ask me for a number in mile
2. It converts miles to kilometers在下面的代码示例中,添加 “import” 可以提示模型应以 Python 代码开始编写。(类似地,在 SQL 语句开头使用 “SELECT” 是一个很好的引导。)正确示范✔
Write a simple python function that
1. Ask me for a number in mile
2. It converts miles to kilometersimport

9. 使用 Generate Anything


http://www.mrgr.cn/news/89866.html

相关文章:

  • Docker 和 Docker Compose
  • 从0开始达芬奇(6)
  • 【工具】CountUp.js
  • CSS的小知识
  • extends配置项详解
  • Python脚本自动发送电子邮件
  • ubuntu 本地部署deepseek r1 蒸馏模型
  • AlwaysOn 可用性组副本所在服务器以及该副本上数据库的各项状态信息
  • .net的一些知识点6
  • C++效率掌握之STL库:string函数全解
  • 【Unity2D 2022:UI】创建滚动视图
  • DeepSeek:探索人工智能的新边界
  • 【csp/信奥赛C++语法学习如何入门?】
  • 【DeepSeek论文精读】2. DeepSeek LLM:以长期主义扩展开源语言模型
  • 循环神经网络
  • 【2】Cisco SD-WAN 组件介绍
  • docker /var/lib/docker/overlay2目录把磁盘空间占满问题
  • 排序算法--快速排序
  • Linux高并发服务器开发 第十六天(execlp/execl 进程回收/孤儿进程/僵尸进程 wait/waitpid回收 进程间的通信)
  • VIVADO生成DCP和EDF指南
  • 【漫话机器学习系列】084.偏差和方差的权衡(Bias-Variance Tradeoff)
  • C++开发(软件开发)常见面试题
  • Mysql知识梳理(数据库的锁梳理,Mysql优化)
  • Android13-系统服务大管家-ServiceManager进程-启动篇
  • 【从零开始系列】DeepSeek-R1:(本地部署使用)思维链推理大模型,开源的神!——Windows / Linux本地环境测试 + vLLM / SGLang远程部署服务
  • C# winforms 使用菜单和右键菜单