liveBook · Manning

Prompt structure

As explained in Grokking AI Applications

The organization of a prompt into clearly distinguishable parts that a language model can parse.

Prompt structure organizes a request into clearly distinguishable parts, giving a language model the context it needs to parse the task rather than relying on shared shorthand. section 3.1

A practical standard template is:

  • Role: identify the human role the model should impersonate, such as an experienced marketing manager. section 3.1
  • Task: state what the model must complete. section 3.1
  • Features: specify the desired qualities or characteristics of the result. section 3.1
  • Examples: show the intended result or pattern. section 3.1

Translation request

Instead of presenting an indistinct request, specify the target language and place the text to be translated in an easily recognizable format. section 3.1

Figure 3.4 Role, Task, Features, and Examples—elementary, my dear Watson

Use the diagram to review how role, task, features, and examples combine into one prompt. section 3.1

How Grokking AI Applications covers it

How deep it goes
Explains a four-part template and the rationale for specifying a role, with examples supporting practical use.
Examples
Uses translation formatting, a marketing-manager role, and a four-part standard template.
What it assumes
Assumes awareness that language models are stateless and teaches how to supply necessary context, history, and background.
What you can do after
Apply prompt structure by composing requests with explicit roles, tasks, features, examples, and recognizable inputs.
How it connects
Connects prompt structure to prompt engineering, language models, context, history, and background.

Also explained in

Compare how 2 books explain prompt structure →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking AI Applications. The section links point to the parts of the book it draws on.