Tutorials / Prompt Engineering with ChatGPT / Controlling length, tone and format

Controlling length, tone and format

14 min read text
Course contents (19 lessons)
  1. Understanding the tool
  2. What a language model is, in plain words
  3. How ChatGPT works from a user's point of view
  4. Building a good prompt
  5. The anatomy of a good prompt
  6. Being specific: how to remove guesswork
  7. Showing examples: few-shot prompting
  8. Asking for step-by-step reasoning
  9. Controlling and improving answers
  10. Controlling length, tone and format
  11. Iterating: how to improve an answer with follow-ups
  12. Custom instructions and memory
  13. Working with files and images
  14. ChatGPT for real tasks
  15. Using ChatGPT for writing: emails, reports and rewrites
  16. Using ChatGPT for studying and learning
  17. Using ChatGPT for coding and technical work
  18. Using ChatGPT for data, spreadsheets and business tasks
  19. Prompt templates
  20. A library of reusable prompt templates
  21. Reliable and safe use
  22. Avoiding hallucinations and checking facts
  23. Privacy and safe use
  24. Workflows and final project
  25. Building repeatable workflows and custom assistants
  26. Final project: build your own prompt toolkit

Content and shape are separate decisions

When you ask a question, there are two things to decide: what the answer says and how it looks. Most people only think about the first. If you do not state the second, the model chooses for you, and it often chooses long, general and bullet-heavy. A single line about shape can save you ten minutes of editing.

Length

Give a number. Words, sentences, bullets or paragraphs all work. Exact counts are followed roughly and not precisely, but a number still beats "short".

Explain what inflation is in 3 sentences, for a school student.
Summarise the article below in 5 bullet points, each under 15 words.
Then give a one-line takeaway.

[paste article]

The models are not good at counting words exactly, especially in long texts. If a hard limit matters, such as a text box with a character limit, ask for a bit under the limit and count yourself. You can also say "if the draft is over 150 words, cut it down and tell me the new count", which makes it check.

Tone

Tone words mean different things to different people. Pair a tone word with a comparison or an example so it is clear.

Write a reply to this customer complaint.

Tone: calm and respectful, like a senior support agent who is not
defensive. Own the mistake in one sentence, no long apology, no
corporate phrases such as "we value your feedback". Offer the fix
in the second sentence.

Complaint: "My parcel arrived two weeks late and the box was crushed."

Describing the tone through behaviour (own the mistake, no long apology, fix in sentence two) works better than the word "professional". The list of phrases to avoid takes away the most likely clichés.

Another trick is to supply the tone from a sample of your own writing: "Match the tone of the text below." That is the few-shot idea again.

Format: lists, tables and layouts

Name the format directly. Here are some formats that work well:

Compare these three laptops for a student who edits video:
Laptop A: 16 GB memory, 512 GB storage, 1.8 kg
Laptop B: 8 GB memory, 1 TB storage, 1.3 kg
Laptop C: 32 GB memory, 512 GB storage, 2.4 kg

Make a table with columns: Laptop, Memory, Storage, Weight, Best for.
Under the table, write one sentence on which I should pick and why.

Tables suit comparisons. Bullet points suit parallel items. Numbered lists suit steps in order. Short paragraphs suit explanations and anything with reasoning, where bullets would cut the logic into pieces. For an email or letter, say so and give the parts you want: subject line, greeting, body, closing.

Asking for structured data

If you plan to paste the output into a spreadsheet, a program or another tool, ask for a strict machine-friendly format. JSON and CSV are common.

From the text below, extract every person mentioned and return a JSON
array. Each item must have the keys "name", "role" and "company".
Use null where the text does not say. Return only the JSON, with no
explanation before or after it.

Text: "Sana Iqbal, the CTO of Brightline, met Omar Raza from Delta Freight
and a designer called Lee."

Notes on why this works. It names the exact keys, so the output is predictable. It says what to do with missing information (null) instead of guessing "Unknown company". And "return only the JSON" prevents the chatty intro that would break a program reading the reply. Still, always validate the result before using it in anything automatic, since a model can occasionally produce a broken bracket or a stray comment. Some tools offer a setting that forces valid structured output; check whether yours has one.

For spreadsheets, CSV is easier:

Turn this list into CSV with a header row: item, quantity, unit_price.
Put values with commas inside double quotes. No extra text.

Three blue notebooks at 2.50 each, one box of pens (12 pens) at 6.00,
two staplers at 8.75 each.

Reading level and audience

You can steer difficulty by naming the reader: "for a 10-year-old", "for a nurse who has no maths background", "for a developer who knows Python but not networking". These beat "make it simple", because "simple" has no fixed meaning.

Set a style once, then reuse it

If you always want the same style, write it as a short block and paste it at the top of prompts, or save it as a custom instruction (see the lesson on that). Here is an example of a style block:

Style rules for all answers in this chat:
- Plain English, short sentences.
- Answer first, explanation after.
- No more than 150 words unless I ask for more.
- If you are unsure, say so.

The common mistake

Stacking too many format rules and then being annoyed that one is missed. Five rules are usually followed; fifteen are not. Keep the important ones and put the most important first. Also, asking for a table when the content has no real columns gives a forced, awkward table. Choose the format that fits the content, not the other way round.

Try it yourself

  1. Ask for the same explanation four times: as 3 sentences, as 5 bullets, as a table, and as a short email. Note which suits your purpose.
  2. Paste three rows of data from your own work and ask for CSV and for JSON. Open the CSV in a spreadsheet to check it.
  3. Write your own five-line style block and test it on two unrelated questions.
text
Write a reply to this customer complaint.

Tone: calm and respectful, like a senior support agent who is not
defensive. Own the mistake in one sentence, no long apology, no
corporate phrases such as "we value your feedback". Offer the fix
in the second sentence.

Complaint: "My parcel arrived two weeks late and the box was crushed."

This course is free to read. Create a free account to enrol, save your progress and pick up where you left off.

Sign up free I already have an account