
【中文文檔】
[ 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.
You can find the corresponding Prompt in the LangGPT folder. Note that the prompt is still in developing.
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.
Your_Role_Name in Role: Your_Role_Name with your desired role name.# Profile section:Language as中文, English , or any other language, using the target language for expression.Description .### Skill section. You can set multiple skills with bulleted descriptions for each skill.## Rules : Add rules that the role must follow, typically covering required or prohibited actions, such as "Don't break role under any circumstance," etc.## Workflow : Explain how the role should interact with users, the input users should provide, and how the role should respond.## Initialization : The Role template sets up the role based on the template content, typically without modifications needed.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 the Language field.Markdown's hierarchical structure allows ChatGPT to easily identify the content represented by variables:
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.
## 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?,自動運行?,輸出超長,一鍵完成項目框架構建! ?️ |
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 | ? ? |
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: