-
[2024.12.13 更新]: 提示词的道和术 我们举办的中国提示词工程师大会上,来自中国的提示词布道师李继刚分享了自己提示词创作的经验。
-
[2024.12.13 更新]: 从Demo到商用— 构建企业级提示词工程,加速AI应用商用落地 我们举办的中国提示词工程师大会上,来自中国的AI大模型公司百川智能商业技术总监郭美青分享了企业级提示词工程构建经验。
-
[2024.12.13 更新]: 系统论述:大模型绘画指南,开启AI生产力绘图新时代! 用大模型绘制文字卡片
-
[2024.09.10 更新]:提示词攻击、越狱、泄露和防护, 本文介绍了国内外 AI大模型的安全现状,有关提示注入、越狱、系统提示泄露等攻击方法和防护手段
-
[2024.06.10 更新]:多模态提示词与智能体, 本文介绍了 GPT-4O 等多模态模型可使用的标记提示法和标记集提示法。
应用案例推荐:gptpdf 项目 , 使用 GPT4o 完美解析 PDF。 方法简单但是很有效,使用 PyMuPDF 库,对 PDF 进行解析出所有非文本区域,并做好标记,然后使用视觉大语言模型(如 GPT-4o)将 PDF 解析为 markdown。几乎可以完美地解析排版、数学公式、表格、图片、图表等。
-
[2024.04.22 更新]:PromptShow 上线|轻松展示分享你的结构化提示词 欢迎访问 https://show.langgpt.ai/ 试用
-
[2024.04.13 更新]:提示词工程师必看系列:如何写好Prompt?
-
[2024.04.03 更新]:如何让 LLM 应用性能登峰造极
-
[2024.01.31 更新]:GPTs: LangGPT 提示词专家 自动化创建结构化提示词的简易版 GPTs, 持续更新中
-
[2024.01.14 更新]:年度分享:“AI 交流的艺术:Prompt Engineering 2023 年度视角”
-
[2023.12.20 更新]:【创业邦采访】欢迎来到提示词的美丽新世界
-
[2023.10.31 更新]:AI 超级个体见面会分享发言稿 和 PPT, 模板增加 tools 模块
-
[2023.9.03 更新]:BiliBili 视频教程(感谢 AIGCLINK)
-
[2023.8.31 更新]:Prompt 进阶 —— 提示链(Prompt Chain)和多提示词协同
-
[2023.7.30 更新]:系统论述:构建高性能 Prompt 之路——结构化 Prompt
The LangGPT project aims to facilitate the seamless creation of high-quality ChatGPT prompts for everyone by utilizing a structured, template-based methodology. It can be viewed as a programming language specifically crafted for designing prompts for large language models.
Current prompt design methods tend to offer only a handful of tips and principles, without a systematic and adaptable perspective. LangGPT transforms the prompt design process by incorporating templates, variables, and commands, enabling prompt creation to be as intuitive and straightforward as object-oriented programming. LangGPT sets the stage for the large-scale, efficient production of high-quality prompts.
With a solid grasp of LangGPT, you'll be able to quickly and effortlessly begin creating prompts for large language models in just a few minutes. 🚀 No need to save so many prompts anymore!
You can find out more details in the paper. For Chinese version you can check:中文版
更新内容 | 简介 | 更新日期 |
---|---|---|
LangGPT 论文 | LangGPT: Rethinking Structured Reusable Prompt Design Framework for LLMs from the Programming Language, 中文版 | 2024.2.26 |
GPTs: LangGPT 提示词专家 | 自动化创建结构化提示词的GPTs | 2024.1.31 |
视频 01-BiliBili 视频教程 | B 站 UP 主 AIGCLINK 制作的 LangGPT 视频教程!感谢 AIGCLINK! | 2023.9.03 |
文章 01-系统论述:构建高性能 Prompt 之路——结构化 Prompt | 关于结构化提示词看这篇就够了! | 2023.7.30 |
文章 02-Prompt 进阶 —— 提示链(Prompt Chain)和多提示词协同 | Prompt Chain 和 Prompt 协同,任务拆解等, LangGPT 社区联署联创文章. | 2023.8.31 |
知识库 01-LangGPT 提示词知识库 | LangGPT 提示词社区收集整理的提示词资料. | 2023.9.03 |
You can begin utilizing LangGPT for crafting potent prompts by simply continue the shared chat using GPT-4. This tool will empower you to craft, or adeptly transform traditional prompts into powerful LangGPT prompts.
- LangGPT GPTs GPTs for LangGPT
- LangGPT Helper For GPT-3.5
You can find the corresponding Prompt in the LangGPT
folder. Note that the prompt is still in developing.
- Markdown. If you're not familiar with it, you can refer to this Markdown Tutorial. (JSON, YAML, and other formats are also acceptable; contributions are welcome)
- GPT-4 (preferred) or Claude.
Here, we provide a small FitnessGPT
example to help you quickly get started with LangGPT. LangGPT offers prompt-writing templates, which you can use to rapidly create high-quality prompts.
# Role: FitnessGPT
## Profile
- Author: YZFly
- Version: 0.1
- Language: English
- Description: You are a highly renowned health and nutrition expert FitnessGPT. Take the following information about me and create a custom diet and exercise plan.
### Create custom diet and exercise plan
1. Take the following information about me
2. I am #Age years old, #Gender, #Height.
3. My current weight is #Currentweight.
4. My current medical conditions are #MedicalConditions.
5. I have food allergies to #FoodAllergies.
6. My primary fitness and health goals are #PrimaryFitnessHealthGoals.
7. I can commit to working out #HowManyDaysCanYouWorkoutEachWeek days per week.
8. I prefer and enjoy his type of workout #ExercisePreference.
9. I have a diet preference #DietPreference.
10. I want to have #HowManyMealsPerDay Meals and #HowManySnacksPerDay Snacks.
11. I dislike eating and cannot eat #ListFoodsYouDislike.
## Rules
1. Don't break character under any circumstance.
2. Avoid any superfluous pre and post descriptive text.
## Workflow
1. You will analysis the given the personal information.
2. Create a summary of my diet and exercise plan.
3. Create a detailed workout program for my exercise plan.
4. Create a detailed Meal Plan for my diet.
5. Create a detailed Grocery List for my diet that includes quantity of each item.
6. Include a list of 30 motivational quotes that will keep me inspired towards my goals.
## Initialization
As a/an <Role>, you must follow the <Rules>, you must talk to user in default <Language>,you must greet the user. Then introduce yourself and introduce the <Workflow>.
With the help of prompt above, you will create a Role named FitnessGPT, he/her will help you design wonderful personal diet and exercise plan.
Here are more LangGPT prompts. The examples
folder contains LangGPT prompt examples, including prompts and complete conversations with ChatGPT, to help you create wonderful prompt.
ChatGPT excels at role-playing. By providing role descriptions, role behaviors, and skills, it can produce actions that align well with the role.
Therefore, LangGPT designed the Role template to help ChatGPT better understand user intentions. The Role template is the core of LangGPT.
Here is the markdown Role template:
# Role: Your_Role_Name
## Profile
- Author: YZFly
- Version: 1.0
- Language: English or 中文 or Other language
- Description: Describe your role. Give an overview of the role's characteristics and skills
### Skill-1
1.skill description 1
2.skill description 2
### Skill-2
1.skill description 1
2.skill description 2
## Rules
1. Don't break character under any circumstance.
2. Don't talk nonsense and make up facts.
## Workflow
1. First, xxx
2. Then, xxx
3. Finally, xxx
## Tools
### browser
You have the tool `browser` with these functions:
- Issues a query to a search engine and displays the results.
- Opens the webpage with the given id, displaying it.
- Returns to the previous page and displays it.
- Scrolls up or down in the open webpage by the given amount.
- Opens the given URL and displays it.
- Stores a text span from an open webpage. Specifies a text span by a starting int `line_start` and an (inclusive) ending int `line_end`. To quote a single line, use `line_start` = `line_end`.
### python
When you send a message containing Python code to python, it will be executed in a
stateful Jupyter notebook environment. python will respond with the output of the execution or time out after 60.0
seconds. The drive at '/mnt/data' can be used to save and persist user files. Internet access for this session is disabled. Do not make external web requests or API calls as they will fail.
### dalle
Whenever a description of an image is given, use dalle to create the images and then summarize the prompts used to generate the images in plain text. If the user does not ask for a specific number of images, default to creating four captions to send to dalle that are written to be as diverse as possible.
### More Tools
## Initialization
As a/an <Role>, you must follow the <Rules>, you must talk to user in default <Language>,you must greet the user. Then introduce yourself and introduce the <Workflow>.
The Role template
primarily consists of four sections:
Profile
: The role's resume, including role description, characteristics, skills, and any other desired traits.Rules
: Rules the role must follow, usually involving actions they must take or avoid, such as "Never break role" and so on.Workflow
: The role's workflow, detailing the type of input users should provide and how the role should respond.Initialization
: Initializing the role according to the Role template's configuration, with most cases requiring only the default content.
A role can be defined and configured using the four sections defined above.
Additionally, if you need to create complex prompts with commands, reminder, and other features, simply add the corresponding sections, as demonstrated in the advanced usage section.
- Set the role name: Replace
Your_Role_Name
inRole: Your_Role_Name
with your desired role name. - Write the role's resume in the
# Profile
section:- Set the language by specifying
Language
as中文
,English
, or any other language, using the target language for expression. - Briefly describe the role after
Description
. - Add role skills under the
### Skill
section. You can set multiple skills with bulleted descriptions for each skill.
- Set the language by specifying
- Establish rules under
## Rules
: Add rules that the role must follow, typically covering required or prohibited actions, such as "Don't break role under any circumstance," etc. - Define the workflow under
## Workflow
: Explain how the role should interact with users, the input users should provide, and how the role should respond. - Initialize the role under
## Initialization
: The Role template sets up the role based on the template content, typically without modifications needed. - Copy the completed Role template content into the ChatGPT conversation box (or API) and enjoy!
As people continue to explore the capabilities of large models, LangGPT is still under development and refinement. Everyone is welcome to contribute to the LangGPT project, making it easier to use large models.
Variables offer significant versatility in prompt writing, simplifying the process of referencing role content, setting, and modifying role attributes.
This is an aspect that traditional prompt methods often find challenging to execute.
The Initialization
part of the Role template makes extensive use of variables:
As a/an <Role>, you must follow the <Rules>, you must talk to the user in the default <Language>, you must greet the user. Then introduce yourself and introduce the <Workflow>.
In LangGPT, variables are denoted by "<>". The variables here are:
<Role>
variable, representing the content of the entire Role.<Rules>
variable, representing the rules in the## Rules
section.<Language>
variable, representing the value of theLanguage
field.
Markdown's hierarchical structure allows ChatGPT to easily identify the content represented by variables:
- Role is the article title, with a scope covering the entire text.
- Rule is a paragraph title, with a scope limited to the paragraph.
- Language is a field with a scope limited to the text specified after the colon.
Commands
make it easy to set some default actions, such as "/help" to provide help documentation, "/continue" to continue writing text
etc. which are all very useful commands.
- Use '/' as the convention to indicate commands.
- Add the following content to the Role template:
## Commands
- Prefix: "/"
- Commands:
- help: This means that user do not know the commands usage. Please introduce yourself and the commands usage.
- continue: This means that your output was cut. Please continue where you left off.
Using a Reminder
can help alleviate ChatGPT's forgetting issue.
Add a Reminder
to the Role template:
## Reminder
1. 'Description: You will always remind yourself role settings and you output Reminder contents before responding to the user.'
2. 'Reminder: The user language is language (<language>), rules (<rules>).'
3. "<output>"
Use conditional statements just like in programming, with a template like:
If [situation1 happen], you will take [action1], else, you will take [action2]
Although LangGPT currently employs markdown language, any markup method capable of expressing hierarchical relationships, such as JSON or YAML, can also be utilized.
Maybe ChatGPT could assist in creating a conversion script?
GPTs | 点击开玩 | 介绍 |
---|---|---|
LangGPT 提示词专家✍️ | 点击开玩 | 结构化提示词 GPTs 全量官方版本!🎯📚 简单一键,即可生成有条理的提示词,提升你的写作和创作效率!🔍✨ |
PromptGPT✍️ | 点击开玩 | 结构化提示词lite版,年薪百万的大厂提示词工程师帮你写高质量提示词,快上车体验驾驭大模型的爽感! |
SmartGPT-5🧠 | 点击开玩 | 永不变懒,聪明勤奋的GPT!提前体验 GPT-5 的爽感! |
中文演讲标题大师🌈 | 点击开玩 | 想要完美的中文演讲标题?演讲标题大师来帮忙!🚀 提供10个精准、吸引人的标题,让您的演讲内容大放异彩!🌈! |
MathGPT🏅 | 点击开玩 | 解题能力又强又准的数学专家!🤓📚 将问题转化为方程并解决它们。你的数学伙伴来帮你做作业!🏅✏️! |
PPT Maker🎨 | 点击开玩 | PPT大师,帮你制作有内容的 PPT 🚀 它浏览网页以获取内容,概述您的PPT,并使用前沿内容填充幻灯片。🖥️✨ |
WriteGPT✍️ | 点击开玩 | WriteGPT:专业写作专家!📝🚀 专业为任何行业制作高质量的文书。📈📚 |
LogoGPT🎨 | 点击开玩 | 使用LogoGPT创建漂亮的Logo!🖌️ |
Data Table GPT📊 | 点击开玩 | 复制并粘贴您的杂乱数据!将杂乱的数据转换为整洁的数据表。📁✨ |
Coding Expert👨💻 | 点击开玩 | 编程专家,轻松解决你的所有编码难题!🛠️💻! |
PDF Reader🧐 | 点击开玩 | PDF阅读器:深入文档!帮助你结构化高效阅读文档。📋👁️! |
Research Paper Reading📚 | 点击开玩 | 研究论文阅读助手:遵循阅读三步法来帮助你掌握学术论文。️📈📚! |
EmojiGPT🌈 | 点击开玩 | 将文本转换为表情符号艺术!💌💥! |
Travel Planning📅 | 点击开玩 | 旅行规划助理:您的旅程设计师!为您量身定制的个性化行程,让您的每一次旅行都令人难忘。️🌍🗺️🏖️! |
Picture Creator🎨 | 点击开玩 | 漂亮手办娃娃生成:释放你的想象力!为风格化的图像生成详细的、很酷的提示。🔥👾! |
LinuxGPT🐧 | 点击开玩 | LinuxGPT:释放Linux的力量!专注于bash脚本和命令行操作。提升您的linux技术!🚀👨💻! |
PytorchGPT🔥 | 点击开玩 | PytorchGPT:你的PyTorch代码耳语者!🤖🔥 熟练地制作和解释PyTorch模型代码,从简单的网络到复杂的架构。🧠💻! |
🎀翻译大小姐 | 点击开玩 | 来自刚哥的信达雅翻译,年薪百万的翻译小姐姐为你打工!最棒的中文翻译,信达雅,超级地道优雅的中文表达! |
时事热评员🎙️ | 点击开玩 | 热评员:意见领袖!🎤💡 为您的主题提供深刻见解和热评,帮助您洞察核心价值!🌐🔖 |
AI算法工程师 | 点击开玩 | AI 设计 AI |
StableAudioGPT | 点击开玩 | Stable Audio 提示词生成 |
🛠️AutoGPT(coding) | 点击开玩 | AutoGPT👨💻,自动运行📈,输出超长,一键完成项目框架构建!🖲️ |
- securityGPT Protect your GPTs through secure prompts to prevent malicious data leaks.
- AIPainting-Structured-Prompts 结构化生成 AI绘画创作的Prompt,适用于DALLE和MidJourney等多平台。
The project is currently in its early and primitive stages, with a significant workload. We wholeheartedly welcome interested and skilled individuals to join and contribute to the project! 🆘
Task | Description | Status |
---|---|---|
Role Basic Template | Basic Prompt role design template, encompassing a majority of use cases | ✅ |
Documentation and Usage | Fundamentals of documentation, usage, and simple examples | ✅ |
Advanced Syntax Features | Develop more advanced syntax features alongside improvements in large model capabilities, such as longer context lengths, better long-term memory, and plugins | 📆 🆘 |
Prompt Chain | Collaboration between multi-role and prompt chains | 📆 🆘 |
Support for JSON/YAML | Support for JSON, YAML, and other markup formats to streamline development | 🔜 🆘 |
Role Advanced Template | Build upon the basic template by incorporating commands, environment settings, plugin functionality, network control, and other advanced features | 🔜 🆘 |
Examples | Supply more LangGPT template-based prompt examples and comprehensive conversation usage | ✅ |
Documentation | Enhance documentation and perfect usage | ✅ |
Website | Display documentation and examples for easy access | 📆 🆘 |
- Please feel free to share and promote the LangGPT project, enabling more people to create better prompts and expand the project's influence!
- We encourage the development of interesting Prompts using the LangGPT Role template and invite submissions of high-quality examples!
- Contributions beyond the Role template, such as additional templates, are welcomed!
- Help enhance project documentation by correcting typos, grammar errors, and more!
- Assist in building the project website for better accessibility!
- Offer access to ChatGPT plugin capabilities for development testing purposes!
- We appreciate any and all contributions that positively impact the LangGPT project!
If you are not familiar with using GitHub, you can refer to: GitHub Minimal Contribution Guide: Issue and PR
If you used or referenced this project, please cite it in the following format:
@misc{wang2024langgpt,
title={LangGPT: Rethinking Structured Reusable Prompt Design Framework for LLMs from the Programming Language},
author={Ming Wang and Yuanzhong Liu and Xiaoming Zhang and Songlian Li and Yijie Huang and Chi Zhang and Daling Wang and Shi Feng and Jigang Li},
year={2024},
eprint={2402.16929},
archivePrefix={arXiv},
primaryClass={cs.SE}
}
Following projects provided great prompts, which inspired the creation of LangGPT: