The effective use of existing large language models heavily depends on high-quality prompts. However, writing such prompts is still an art that relies extensively on personal experience.
Although many individuals spontaneously share prompt methods, frameworks, and even tutorials like those by Andrew Ng, existing prompt creation methods still have various shortcomings:
- Lack of systemization: They mostly consist of fragmented rules and tricks, heavily reliant on personal experience.
- Lack of flexibility: Adapting shared high-quality prompts from others requires direct modification of the prompt content.
- Lack of user-friendliness: The setup and usage of high-quality prompts are often too complex, sometimes necessitating learning about prompt usage.
- Inadequate consideration of the following characteristics of large language models:
(1) Preference for bullet points and orderly narratives.
(2) Long conversations can suffer from forgetfulness.
(3) Performance varies between different languages.
This is why people love to collect and share tried-and-true prompts.
With the advent of the GPT-4 model, reliance on prompts has decreased. Meanwhile, its stronger foundational capabilities provide a solid basis for using more powerful prompts. High-quality prompts are becoming increasingly potent and complex.
Writing prompts is becoming more akin to programming in the AI era.
So, is it possible to master some basic rules and concepts, grasp some programming patterns (similar to object-oriented programming), and efficiently write high-performing prompts — akin to “prompt programming”?
After preliminary exploration and experimentation, we’ve designed LangGPT, hoping to take a small step forward in the realm of “prompt programming”.
LangGPT opens the possibility for mass production of high-quality prompts, offering the following advantages:
- Systemization: Provides “templates” where you can simply fill in the appropriate content.
- Flexibility: Allows the use of “variables” to easily reference, set, and change content within prompts, offering good programmability.
- User-friendly commands for setting and executing predefined actions, enabling easy language switching without performance loss.
- User-friendliness: “Workflows” easily define user interactions, role behaviors, etc., guiding users with ease.
4.Fully leverages large model capabilities:
(1) Modular configuration.
(2) Bullet points for orderly narratives.
(3) Reminder to mitigate long-term memory loss issues.
Key LangGPT syntax elements:
LangGPT Variables:
We’ve found that ChatGPT can identify various well-marked hierarchical text structures. Large models can recognize article titles, paragraph names, body text, etc. If we tell it a title, the model knows we’re referring to the title and the text underneath.
This implies that we can present prompt content in a structured manner and set a title to easily reference, modify, and even edit prompt content. You can directly use paragraph titles to refer to large chunks of content, or instruct ChatGPT to modify specified content. This is similar to variables in programming, hence we can use such titles as variables.
Markdown’s syntax hierarchy is good and suitable for writing prompts, so LangGPT’s variables are based on markdown syntax. Actually, any well-marked formats such as JSON, YAML, or even well-formatted text can work.
Variables bring great flexibility to prompt writing. Using variables, you can conveniently reference character content, and set and change character properties, which is not easily done with regular prompt methods.
LangGPT Templates:
ChatGPT excels at role-play. Most high-quality prompts often start with “I want you to act as xxx” or “I want you to play xxx”, defining a role. As long as you provide a role description, behaviors, skills, etc., it can act very much in line with the role.
If you’re familiar with “objects” in programming languages, you’ll know that a prompt’s “role declaration” is similar to class declaration. Therefore, we can abstract a prompt into a role (“Role”) that includes a name, description, skills, working methods, etc., which leads us to LangGPT’s Role template.
With the Role template, you simply need to fill in the corresponding content.
In addition to variables and templates, LangGPT also offers command settings, memory settings, conditional sentences, and other syntax options.
LangGPT Prompt Generator:
Worth mentioning is the LangGPT Assistant we’ve designed to help everyone use LangGPT. It assists in creating great ChatGPT prompt.
LangGPT is still in its exploration and development stage. Feedback is welcome, and we encourage more people to participate! Follow + Star and join us in this journey! Our goal is to inspire and enable everyone to become a virtuoso in prompt creation!
Github Project: yzfly/LangGPT
https://github.com/yzfly/LangGPT