Introduction

Welcome to our next lesson, titled "Bullets of Clarity: Structuring List Responses in Prompt Engineering." In this journey of understanding and mastering prompt engineering for Large Language Models (LLMs) it's essential to guide the models to generate responses in specific formats to meet our varied requirements. This lesson focuses on the structuring of prompts that yield organized, bulleted list outputs. Whether you're generating a list of ideas, steps in a process, or items in a category, mastering this skill will enhance the clarity and usability of the AI's responses.

Core Principles of Formatting for Bulleted Lists

Clarity and precision are the cornerstones of prompt engineering. When asking an LLM to generate a bulleted list, the prompt must communicate, not only the request for information but also the desired structure of that information.

Here are some core principles to remember:

  • Be explicit about the format: Directly mention that you want the output in a bulleted list format.
  • Contextualize the ask: Provide enough background information to make the response accurate and relevant.
  • Simplicity is key: Keep the prompt straightforward to avoid confusing the model.

Let's compare two prompts. One lacks specific formatting instructions, while the other includes them:

Without Formatting Instructions:
__ASK__
List the health benefits of drinking water.

This will return a fairly long and not fully structured result likely including an introduction and a conclusion.

With Formatting Instructions:
__ASK__
Provide a bulleted list of the health benefits of drinking water.

__CONSTRAINTS__
- Do not include an introduction or a conclusion
- Use a bulleted list to organize the list

Sample output:

- Maintains balance of body fluids
- Helps control calories
- Energizes muscles
- Supports skin health and beauty
- Ensures proper kidney function
- Maintains normal bowel function

As you can see here we have a more focused and better structured output.

Getting Intro Sub-Bullets

What if we wanted to enhance the prompt further to include sub-bullets. We can do that both through constraints and better yet through an example.

__ASK__
Provide a bulleted list of the health benefits of drinking water.

__CONSTRAINTS__
- Do not include an introduction or a conclusion
- Use a bulleted list to organize the list.
- Include only a few top-level bullets but go one or more level deeper to add sub-bullets.

__FORMAT EXAMPLE__

- **Hydration and Physical Health**
  - **Maintains balance of body fluids**
    - Aids in digestion
    - Regulates body temperature
    - Transports nutrients
  - **Energizes muscles**
    - Prevents muscle fatigue
    - Enhances exercise performance
  - **Ensures proper kidney function**
    - Helps flush out toxins
    - Reduces risk of kidney stones
...

Notice how in this example we named the section not __EXAMPLE__ but __FORMAT EXAMPLE__ to specify that this is not an exact example but rather a demonstration of the format. Also note that even though we didn't specify that the top bullets should be bolded in our requirements, the format example is enough to get that output.

Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal