LangGPT: High Quality Prompts and Outputs

Prompt hacking your way into high quality outputs

The ability to make good use of existing large models relies heavily on high-quality prompts. However, writing high-quality prompts is still a craft at this stage and relies too much on personal experience.

Although there are many prompt methods and frameworks, as per our last article “Top 5 Prompt Engineering Frameworks”, the existing prompt creation methods still have various shortcomings:

1. Lack of system: mostly fragmented rules and techniques, heavily dependent on personal experience.

2. Lack of flexibility: Adjusting a high-quality prompt shared by others requires directly modifying the prompt content.

3. Lack of interactive friendliness: The configuration and use of high-quality prompts are too complicated, and sometimes you often have to learn how to use prompts.

4. The following characteristics of large language models are not fully considered: (1) preference for point-by-point and logical narration (2) forgetting problems may occur in long conversations (3) performance gaps between different languages.

With the release of the GPT-4 models, the reliance on prompts has been reduced. At the same time, its more powerful basic capabilities provide a good foundation for writing more powerful prompts. High-quality prompts are becoming more powerful and more complex.

So is it possible to master some basic rules and concepts, and some programming patterns (similar to object-oriented programming) just like learning programming, so that you can efficiently write prompts with good performance and stability?

The answer is yes.

LangGPT

Using LangGPT makes it possible to mass produce high-quality prompts. It has the following advantages:

  • Systematic: Provide a "template" and fill in the corresponding content according to the template

  • Flexibility: You can use "variables" to easily reference, set, and change the content in the prompt, which is programmable.

  • Use commands to easily set and execute predefined behaviours, and easily set the switch between Chinese and English without sacrificing performance

  • Friendly interaction: "Workflow" easily defines user interaction, role behaviour, etc., and easily guides users to use

  • Make full use of the capabilities of the large model: (1) Modular configuration (2) Point-by-point logical description (3) Reminder to alleviate the problem of long-term memory loss

Key Grammar Rules of LangGPT

LangGPT variables

We found that ChatGPT can recognize a variety of well-labelled hierarchical structures. The large model can recognize the hierarchical structure of the article title, paragraph name, paragraph body, etc. If we tell it the title, the model knows that we are referring to the title and the body content under the title.

This means that we present the content of the prompt in a structured way and set the title to easily reference, modify, and set the prompt content. You can directly use the paragraph title to refer to a large section of content, or you can tell ChatGPT to modify and adjust the specified content. This is similar to variables in programming, so we can use this title as a variable.

Markdown has a good syntax hierarchy and is suitable for writing prompts, so LangGPT's variables are based on markdown syntax. In fact, in addition to markdown, various other markup functions can be used, such as json, yaml, and even well-formatted formats.

Variables bring great flexibility to prompt writing. Using variables, you can easily reference role content, set and change role attributes. This is inconvenient to implement with general prompt methods.

LangGPT Template

ChatGPT is very good at role-playing. 

Most high-quality prompts often start with "I want you to be xxx" or "I want you to play xxx". To define a role, as long as you provide a description of the role, role behavior, skills, etc., you can perform behaviour that is very consistent with the role.

If you are familiar with "objects" in programming languages, you will know that the "role declaration" of a prompt is very similar to the class declaration. Therefore, prompt can be abstracted into a role, including name, description, skills, working method and other descriptions, and then the LangGPT Role template is obtained.

To use the Role template, you only need to fill in the corresponding content according to the template:

In addition to variables and templates, LangGPT also provides syntax setting methods such as commands, memoization, conditional sentences, etc.

Once you’ve filled in the basic information of the profile, you can start generating outputs. Below is an example of how you can use LangGPT:

# Role: {}

## Profile
- author: LangGPT
- version: 1.0
- language: {English}
- description: {}

## Skills
{}

## Background(OPTIONAL):

## Goals(OPTIONAL):

## OutputFormat(OPTIONAL):

## Rules
{}

## Workflows
{}

## Init
{}

Use Case: Email Drafting Assistant 

# Role: Email Assistant

## Profile

- author: LangGPT 

- version: 1.0

- language: English

- description: You are an Email Assistant designed to help users compose, edit, and optimize their emails for various purposes, including professional, personal, and formal communication.

## Skills

1. Ability to draft clear, concise, and professional emails.

2. Proficient in editing and proofreading for grammar, tone, and clarity.

3. Capable of adapting the email style to suit the context (e.g., formal, informal, persuasive).

4. Expertise in structuring emails with proper greetings, body content, and closing statements.

5. Skilled in suggesting improvements for email content and structure.

## Rules

1. Always maintain a respectful and professional tone in email drafts.

2. Ensure the email is clear, concise, and free of grammatical errors.

3. Tailor the email’s tone and style to match the purpose and audience.

4. Provide optional enhancements or alternatives to improve the email.

5. Respect privacy by avoiding unnecessary personal details unless specified by the user.

## Workflows

1. Understand the purpose of the email and the intended audience.

2. Draft the email based on the user's input, ensuring it meets the intended goal.

3. Review the email for any errors or improvements and suggest changes if necessary.

4. Provide the user with the final draft, along with any optional suggestions for further optimization.

Here’s the output:

Hope this tutorial has been helpful! You can play with LangGPT → here

Share some feedback with us:

Did you find this tutorial helpful?

Login or Subscribe to participate in polls.

As always, subscribe to our newsletter as we will be publishing more practical tips and prompts to optimise your daily work. 

Reply

or to participate.