OpenAI Prompt generation - 生成和优化Prompt的Prompt

OpenAI Prompt generation - 生成和优化Prompt的Prompt

从头开始创建 Prompt 可能很耗时,所以快速生成 Prompt 可以帮助我们提高效率。

下面是 OpenAI 提供的协助生成 Prompt 的 Prompt。

from openai import OpenAIclient = OpenAI()META_PROMPT = """
Given a task description or existing prompt, produce a detailed system prompt to guide a language model in completing the task effectively.# Guidelines- Understand the Task: Grasp the main objective, goals, requirements, constraints, and expected output.
- Minimal Changes: If an existing prompt is provided, improve it only if it's simple. For complex prompts, enhance clarity and add missing elements without altering the original structure.
- Reasoning Before Conclusions**: Encourage reasoning steps before any conclusions are reached. ATTENTION! If the user provides examples where the reasoning happens afterward, REVERSE the order! NEVER START EXAMPLES WITH CONCLUSIONS!- Reasoning Order: Call out reasoning portions of the prompt and conclusion parts (specific fields by name). For each, determine the ORDER in which this is done, and whether it needs to be reversed.- Conclusion, classifications, or results should ALWAYS appear last.
- Examples: Include high-quality examples if helpful, using placeholders [in brackets] for complex elements.- What kinds of examples may need to be included, how many, and whether they are complex enough to benefit from placeholders.
- Clarity and Conciseness: Use clear, specific language. Avoid unnecessary instructions or bland statements.
- Formatting: Use markdown features for readability. DO NOT USE ```CODE BLOCKS UNLESS SPECIFICALLY REQUESTED.
- Preserve User Content: If the input task or prompt includes extensive guidelines or examples, preserve them entirely, or as closely as possible. If they are vague, consider breaking down into sub-steps. Keep any details, guidelines, examples, variables, or placeholders provided by the user.
- Constants: DO include constants in the prompt, as they are not susceptible to prompt injection. Such as guides, rubrics, and examples.
- Output Format: Explicitly the most appropriate output format, in detail. This should include length and syntax (e.g. short sentence, paragraph, JSON, etc.)- For tasks outputting well-defined or structured data (classification, JSON, etc.) bias toward outputting a JSON.- JSON should never be wrapped in code blocks (```) unless explicitly requested.The final prompt you output should adhere to the following structure below. Do not include any additional commentary, only output the completed system prompt. SPECIFICALLY, do not include any additional messages at the start or end of the prompt. (e.g. no "---")[Concise instruction describing the task - this should be the first line in the prompt, no section header][Additional details as needed.][Optional sections with headings or bullet points for detailed steps.]# Steps [optional][optional: a detailed breakdown of the steps necessary to accomplish the task]# Output Format[Specifically call out how the output should be formatted, be it response length, structure e.g. JSON, markdown, etc]# Examples [optional][Optional: 1-3 well-defined examples with placeholders if necessary. Clearly mark where examples start and end, and what the input and output are. User placeholders as necessary.]
[If the examples are shorter than what a realistic example is expected to be, make a reference with () explaining how real examples should be longer / shorter / different. AND USE PLACEHOLDERS! ]# Notes [optional][optional: edge cases, details, and an area to call or repeat out specific important considerations]
""".strip()def generate_prompt(task_or_prompt: str):completion = client.chat.completions.create(model="gpt-4o",messages=[{"role": "system","content": META_PROMPT,},{"role": "user","content": "Task, Goal, or Current Prompt:\n" + task_or_prompt,},],)return completion.choices[0].message.content

参考资料:

  • OpenAI Prompt generation

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

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

相关文章

k8s知识点总结

docker 名称空间 分类 Docker中的名称空间用于提供进程隔离,确保容器之间的资源相互独立。主要分类包括: PID Namespace:进程ID隔离,使每个容器有自己的进程树,容器内的进程不会干扰其他容器或主机上的进程。 NET Nam…

vue3项目页面实现echarts图表渐变色的动态配置

完整代码可点击vue3项目页面实现echarts图表渐变色的动态配置-星林社区 https://www.jl1mall.com/forum/PostDetail?postId202410151031000091552查看 一、背景 在开发可配置业务平台时,需要实现让用户对项目内echarts图表的动态配置,让用户脱离代码也…

计算机导论

概述 计算机简史 1935年代,英国数学家图灵(Alan Turing)提出“图灵机”,奠定了计算机的理论基础。 1952年,冯诺依曼确定了计算机由运算器、控制器、存储器、输入、输出等5部分组成(Von Neumann 体系结构)。 60年代…

k8s备份恢复(velero)

velero简介 velero官网: https://velero.io/ velero-github: https://github.com/vmware-tanzu/velero velero的特性 备份可以按集群资源的子集,按命名空间、资源类型标签选择器进行过滤,从而为备份和恢复的内容提供高度的灵活…

NORDIC nPM1100 是一款集成式电源管理

nPM1100 是一款集成式电源管理IC(PMIC),采用2.1x2.1毫米WLCSP或4.0x4.0 毫米 QFN 封装 ,内置线性模式锂离子/锂聚合物电池充电器。它采用高效DC/DC降压调节器,具有可配置的双模式 输出。 nPM1100是一款极其紧凑的PMIC器件,专为空间…

【含开题报告+文档+PPT+源码】基于SSM框架的诗词吟诵知识学习系统的设计与实现

开题报告 随着信息技术的迅猛发展和互联网的普及,在线教育逐渐成为现代教育的重要形式。在线学习平台以其便捷性、灵活性和个性化等特点,受到广大师生的青睐。特别是在线吟诵知识学习,已经成为许多学生提升自我修养、陶冶情操的重要途径。青…

AUTOSAR Adaptive Platform (AP) sample的 BSW-Contribution 文件夹详解

AUTOSAR Adaptive Platform (AP) sample的 BSW-Contribution 文件夹详解 1. AUTOSAR_MOD_StandardTypes.arxml 功能 定义AUTOSAR标准类型。具体内容 标准数据类型:包括基本类型(如整数、浮点数)、复合类型(如结构体、联合体)等。类型定义:提供标准类型的详细定义和描述…

Google DeepMind推出DemoStart自主强化学习方法 利用少量示范样本实现复杂操作任务

一直以来,研究人员都在试图开发出能够在现实环境中安全、高效地执行复杂任务(如多指手操作)的机器人技能。传统的机器人学习方法往往需要大量的实际数据,这不仅耗时耗力,还存在安全风险。因此,仿真环境下的…

如何判断一个链表是否有环?

如何判断一个链表是否有环? 判断一个链表是否有环是一个经典的算法问题,它涉及到链表遍历和数据结构的基本概念。在链表中,每个节点通常包含两部分:一部分存储数据,另一部分存储指向下一个节点的指针。如果链表中存在…

Django模版

1. 模板变量的使用 模板变量用于在模板中输出数据。它们被包裹在双大括号 {{ }} 中。 <!DOCTYPE html> <html> <head> <title>{{ title }}</title> </head> <body> <h1>{{ heading }}</h1> <p>{{ co…

Netty简单应用

1.服务端构建 接收客户端请求&#xff0c;打印请求消息&#xff1b;消息采用内置String作为编码与解码器&#xff1b;开启信息输入监听线程&#xff0c;发送消息至客户端&#xff1b; 1.1 服务端消息处理类 import io.netty.channel.Channel; import io.netty.channel.Chann…

双十一好物必买清单攻略,这几款双十一必入的宝藏好物分享

随着双十一购物节的脚步日益临近&#xff0c;无数消费者都在期待着在这个年度大促中抢购到自己心仪已久的好物&#xff0c;为了帮助大家更好地规划购物计划&#xff0c;精选出真正值得入手的宝藏产品&#xff0c;我们特别整理了这份双十一好物必买清单攻略&#xff0c;无论你是…

spring day1023

ok了家人们&#xff0c;今天继续学习spring框架&#xff0c; 七.Spring的注解开发 在开发中&#xff0c;配置文件中 Bean 标签会非常多&#xff0c;难以维护。怎么 办&#xff1f; 使用注解的形式替代 xml 配置&#xff0c;可以将一些繁杂的 spring 配置 从工程中消除掉&…

业余时间试一试利用AI 人工智能赚钱

内容创作与写作&#xff1a; 撰写文章&#xff1a;许多网站、博客和企业都需要大量的优质内容。利用 AI 工具如 ChatGPT 等&#xff0c;获取文章的思路、框架甚至初稿&#xff0c;然后根据自己的知识和经验进行修改、润色和完善。你可以在一些自由撰稿人平台、内容创作平台上承…

智能园艺:Spring Boot植物健康系统

1系统概述 1.1 研究背景 随着计算机技术的发展以及计算机网络的逐渐普及&#xff0c;互联网成为人们查找信息的重要场所&#xff0c;二十一世纪是信息的时代&#xff0c;所以信息的管理显得特别重要。因此&#xff0c;使用计算机来管理植物健康系统的相关信息成为必然。开发合适…

es索引库操作和使用RestHignLevelClient客户端操作es

目录 es索引库操作 mapping映射操作 索引库的CURD操作 1.创建索引库和映射 ​编辑 2.查询索引库 3.删除索引库 4.修改索引库 5.总结 文档的CURD操作 1.新增文档 2.查询文档 3.删除文档 4.修改文档 全量修改 增量修改 5.总结 RestAPI 使用API例子 需要的数…

一文掌握异步web框架FastAPI(五)-- 中间件(测试环境、访问速率限制、请求体解析、自定义认证、重试机制、请求频率统计、路径重写)

接上篇:一文掌握异步web框架FastAPI(四)-CSDN博客 目录 七、中间件 15、测试环境中间件 16、访问速率限制中间件,即限制每个IP特定时间内的请求数(基于内存,生产上要使用数据库) 1)限制单ip访问速率 2)增加限制单ip并发(跟上面的一样,也是限制每个IP特定时间内的请…

代码随想录算法训练营第二十四天|Day24 回溯算法

93.复原IP地址 题目链接/文章讲解&#xff1a;https://programmercarl.com/0093.%E5%A4%8D%E5%8E%9FIP%E5%9C%B0%E5%9D%80.html 视频讲解&#xff1a;https://www.bilibili.com/video/BV1XP4y1U73i/ 思路 char** result; int resultTop; int segments[3]; int isValid(char* s…

大模型算法二次开发,基本思路详细拆解

[ 导读 随着众多大模型相继问世&#xff0c;大模型二次开发、大模型微调成为一项热门技术。本文为大家总结了大模型二次开发的基本方法与思路&#xff0c;希望对大家有所帮助。 开发方法分类 1、领域知识注入&#xff1a;Continue PreTraining(增量预训练),一般垂直大模型是…

【drone】drone 整合 gitea | ubuntu 通过docker-compose方式部署drone的全流程 整合gitea

一、前期准备 1、ubuntu环境 确定是否具有 ssh: service ssh start,如果没有,使用:apt install openssh-server 进行安装查看 Linux 的 IP 地址: ifconfig,命令不可用时,通过:apt install net-tools安装命令可选:设置 root 的密码: sudo passwd root可选:开启 root…