
【Chinese Document】
[ Updated by 2024.09.10 ]: Prompt word attack, jailbreak, leakage and protection. This article introduces the security status of AI models at home and abroad, and provides attack methods and protection methods such as prompt injection, jailbreak, and system prompt leakage.
[ Updated in 2024.06.10 ]: Multimodal prompt words and agents. This article introduces the marking prompt method and marking set prompt method that can be used in multimodal models such as GPT-4O.
Recommended application case: gptpdf project, perfectly parse PDF using GPT4o. The method is simple but very effective. Use the PyMuPDF library to parse all non-text areas of the PDF and mark it, and then use a visual large language model (such as GPT-4o) to parse the PDF into markdown. It can almost perfectly analyze typesettings, mathematical formulas, tables, pictures, charts, etc.
[ 2024.04.22 Update ]: PromptShow is online | Easily display and share your structured prompt words Welcome to https://show.langgpt.ai/ Trial
[ 2024.04.13 Update ]: A must-read series for prompt words engineers: How to write a good Prompt?
[ 2024.04.03 Update ]: How to make LLM application performance reach its peak
[ Updated on 2024.01.31 ]: GPTs: LangGPT Prompt Word Experts automatically create simple versions of structured Prompt Words, and are being updated continuously
[ Updated on 2024.01.14 ]: Annual Share: "The Art of AI Communication: Prompt Engineering 2023 Annual Perspective"
[ 2023.12.20 Update ]: [Enterprise Bang Interview] Welcome to the beautiful new world of prompt words
[ Updated at 2023.10.31 ]: AI Super Individual Meeting Shares Speech and PPT, Add Tools Module to the template
[ Updated on 2023.9.03 ]: BiliBili Video Tutorial (Thanks to AIGCLINK)
[ Updated on 2023.8.31 ]: Prompt Advanced - Prompt Chain and Multi-prompt Word Synergy
[ Updated by 2023.7.30 ]: System Discussion: The Way to Build High-Performance Prompt - Structured 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 grap of LangGPT, you'll be able to quickly and effectively 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: Chinese version
| Update content | Introduction | Update date |
|---|---|---|
| LangGPT Papers | LangGPT: Rethinking Structured Reusable Prompt Design Framework for LLMs from the Programming Language, Chinese version | 2024.2.26 |
| GPTs: LangGPT Prompt Word Expert | Automated creation of GPTs for structured prompt words | 2024.1.31 |
| Video 01-BiliBili Video Tutorial | LangGPT video tutorial produced by UP main AIGCLINK on B station! Thanks to AIGCLINK! | 2023.9.03 |
| Article 01-System Discussion: The Road to Building High-Performance Prompt—Structured Prompt | It’s enough to read this article about structured prompt words! | 2023.7.30 |
| Article 02-Prompt Advanced—Prompt Chain and Multi-prompt Word Synergy | Prompt Chain and Prompt collaborate, task dismantling, etc., LangGPT community joint signature and joint creation articles. | 2023.8.31 |
| Knowledge Base 01-LangGPT Prompt Word Knowledge Base | LangGPT prompt word information collected and compiled by the prompt word community. | 2023.9.03 |
You can begin utilizing LangGPT for crafting potential prompts by simply continuing 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 circumstances," 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 | Click to play | introduce |
|---|---|---|
| LangGPT Prompt Word Expert✍️ | Click to play | Structured prompt words GPTs full official version! With one simple click, you can generate organized prompt words to improve your writing and creative efficiency! ? |
| PromptGPT✍️ | Click to play | Structured prompt word lite version, a large manufacturer with an annual salary of one million yuan, helps you write high-quality prompt words, get on the car and experience the pleasure of driving a big model! |
| SmartGPT-5? | Click to play | Never become lazy, smart and diligent GPT! Experience the cool feeling of GPT-5 in advance! |
| Master of Chinese speech title? | Click to play | Want the perfect Chinese speech title? The master of speech title comes to help! Provide 10 accurate and attractive titles to make your speech shine! ?! |
| MathGPT? | Click to play | A math expert with strong and accurate problem-solving skills! ? Transform problems into equations and solve them. Your math partner will help you with your homework! ?✏️! |
| PPT Maker? | Click to play | PPT Master, helps you make PPT with content It browses the web pages to get content, outlines your PPT, and fills slides with cutting-edge content. |
| WriteGPT✍️ | Click to play | WriteGPT: Professional writing expert! Professionally produce high-quality documents for any industry. ? |
| LogoGPT? | Click to play | Create beautiful logos with LogoGPT! ?️ |
| Data Table GPT | Click to play | Copy and paste your messy data! Convert cluttered data into neat data tables. ? |
| Coding Expert? | Click to play | Programming expert, easily solve all your coding problems! ! |
| PDF Reader? | Click to play | PDF Reader: In-depth documentation! Helps you read documents in a structured and efficient manner. ??️! |
| Research Paper Reading | Click to play | Research Paper Reading Assistant: Follow the three-step reading method to help you master academic papers. ️?! |
| EmojiGPT? | Click to play | Convert text to emoji art! ??! |
| Travel Planning? | Click to play | Travel Planning Assistant: Your Journey Designer! Personalized itinerary tailored for you to make every trip unforgettable. ️??️?️! |
| Picture Creator? | Click to play | Beautiful figure doll generation: Unleash your imagination! Generate detailed, cool tips for stylized images. ?! |
| LinuxGPT? | Click to play | LinuxGPT: Unleash the power of Linux! Focus on bash scripts and command line operations. Improve your Linux technology! ?! |
| PytorchGPT | Click to play | PytorchGPT: Your PyTorch Code Whisperer! ? Proficient in crafting and interpreting PyTorch model code, from simple networks to complex architectures. ?! |
| ?Translation lady | Click to play | Xindaya Translator from Gang Ge, the translation lady with an annual salary of one million works for you! The best Chinese translation, faithful and elegant, super authentic and elegant Chinese expression! |
| Current affairs hot commentator?️ | Click to play | Hot commentator: Opinion leader! ? Provide profound insights and hot reviews on your topics to help you gain insight into core values! ? |
| AI algorithm engineer | Click to play | AI Design AI |
| StableAudioGPT | Click to play | Stable Audio prompt word generation |
| AutoGPT(coding) | Click to play | AutoGPT?, automatically runs?, with a very long output, complete the project framework construction with one click! ?️ |
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: