Generative AIPrompt engineeringCustomizing prompts

Set format and structure

6 minutes read

You are likely already a happy user of ChatGPT, appreciating it as a great source of information and a creative tool. But what if we told you that AI technologies can also serve as rigorous editors and designers? In this topic, we'll delve into how you can instruct ChatGPT to stick to a certain structure in its output. We'll explore the importance of providing specific guidelines, the benefits of structured responses, and how to craft prompts that yield the results you're looking for.

It is already structured, isn't it?

Consider for a moment the value of structure. Just like the bones in our bodies give us form and the ability to move, structure in a ChatGPT output provides clarity and direction. Of course, it's not to say that ChatGPT usually provides a rambling stream of consciousness as an output. But still, when you ask ChatGPT to follow a specific structure, you're guiding it to present information in a way that's logical, digestible, and tailored to your needs.

ChatGPT, with its advanced algorithms, is incredibly adept at generating a wide range of outputs. However, it's not a mind reader. It relies on you to set the parameters for the structure of the conversation. Whether you're looking for a bullet-point list, a five-paragraph essay, or a series of headings with detailed subpoints, the way you frame your prompt is crucial.

For example, if you want an essay format, you might say: "Please write an essay about the impact of technology on education with an introduction, three body paragraphs, and a conclusion."

This prompt gives ChatGPT a clear framework to follow. It knows to start with an introduction, develop three main points, and end with a conclusion.

Enhancing the required structure

Let's dive into some examples to illustrate how you can structure your prompts to get the most out of ChatGPT.

First, here's a prompt without any structure:

PROMPT:
Tell me about the history of the internet
RESPONSE:
The history of the internet is a story of collaboration,
innovation, and the transformation of communication 
and information. Here's an overview of how the internet 
came to be:
<...>

ChatGPT may provide a broad overview, touching on key milestones within the order or format it finds appropriate. This is informative, but it might not suit your specific needs.

Now, let's add some structure:

PROMPT:
Outline the history of the internet in five key points,
 starting from its inception to the present day.
RESPONSE:
1. Inception and Early Development (1960s-1970s):

<...>

2. Expansion and Standardization (1980s):

<...>

This time, ChatGPT has a clear structure to follow, which results in a concise list that's easy to follow and remember.

However, we can go even further:

PROMPT: 
Create a detailed timeline of the internet's history, 
with separate sections for each decade starting from 
the 1960s. Include the most significant technological 
advancements and their impact on society in each period.
RESPONSE:
1960s: Foundations and Theoretical Work

- 1961: Leonard Kleinrock at MIT publishes the first 
paper on packet-switching theory, "Information Flow in 

Large Communication Nets."
- 1962: J.C.R. Licklider of MIT conceptualizes a global 
computer network in his series of memos discussing 
the "Intergalactic Computer Network."
<...>

With this prompt, you're not only asking for structure but also for depth and thematic organization. ChatGPT can now deliver a response that's not only well-structured but also rich in detail and tailored to a specific format.

Keywords and phrases

To get structured responses from ChatGPT, your instructions must be as clear as possible. Keywords and phrases act as signposts that guide ChatGPT towards the desired structure.

If you want a list, include words like "enumerate" or "list out." Here's an example prompt for a list: "Enumerate the top five benefits of learning a second language." From the term "enumerate", ChatGPT will understand that you're looking for a list and not a paragraph of text.

If you're looking for a Q&A format, for instance, you can structure your prompt like this: "Answer the following questions in a Q&A format: What is photosynthesis? Why is it important to plants?" By mentioning a "Q&A format," you're setting a clear directive for ChatGPT's response. It will structure the output as a series of questions followed by answers.

Another idea: a reverse calendar, a great planning tool. You might say: "I need to prepare a lecture for a conference that will occur in 14 days. I am not prepared. Create a reverse calendar to help me meet the deadline". Now, ChatGPT knows that you expect something like "Do this 12 days before the conference, do that 11 days before the conference".

You can also request certain formats of words and sentences. Let's see how it might look: "Create an informative text on the topic of "The Benefits of a Balanced Diet." Please ensure that your text includes: 1) Title: The title should be centered and clearly state the main topic. 2) Bold Words: Use bold formatting to emphasize key terms or important points within the text." This prompt provides clear instructions on how the text should be organized and how the formatting should be applied to enhance the content.

Feel free to experiment with your own prompts to see how it works.

Not only plain text

Are you a programmer? An accountant? ChatGPT will help you in these areas as well.

For example, you can ask the following:

PROMPT:
Create a table with two rows, the first row should have 
all the days of the week from Monday to Friday, and 
the second row should have their translation in Spanish
RESPONSE:
Sure, here's a simple text representation of the table 
you requested:


+---------+---------+---------+---------+---------+
| Monday  | Tuesday | Wednesday | Thursday | Friday |
+---------+---------+---------+---------+---------+
| Lunes   | Martes  | Miércoles | Jueves   | Viernes| 
+---------+---------+---------+---------+---------+

Note that this output is from the ChatGPT 3.5 version. ChatGPT-4 is capable of creating tables.

If you'd like to use this table on your website, you might consider asking ChatGPT to create it in HTML. Use the previous prompt, but add just one extra phrase:

PROMPT:
<...> The table should be in HTML
RESPONSE:
Certainly! Below is the HTML code for a table that 
has the days of the week from Monday to Friday in 
the first row, and their Spanish translations in 
the second row.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Days of the Week in English and Spanish</title>
</head>
<body>

<table border="1">
  <tr>
    <th>Monday</th>
    <th>Tuesday</th>

<...>

ChatGPT knows many other formats: markdown, code snippets, XML or CSV files, and so on. Now it's up to you to decide whether the output meets your needs!

Conclusion

To get the most out of ChatGPT, it's crucial to provide detailed instructions, use keywords effectively, and define the structure you want in your prompt. Here's a quick recap of the main points:

  • By default, ChatGPT will choose the structure it deems most convenient.

  • If you know exactly what you want, explicitly define the structure in your prompt.

  • Use keywords and phrases to guide the AI towards the desired format.

  • Don't feel confined by plain text. You can request code snippets, tables, different types of markdowns, etc.

By following these guidelines, you can master the art of eliciting structured responses from ChatGPT, making it an extremely useful tool for a wide range of applications.

7 learners liked this piece of theory. 0 didn't like it. What about you?
Report a typo