🎓 A1Learner
🔍
0 of 50 lessons completed

Prompt Engineering: Templates

A prompt template is one prompt with a blank for the input. The same template answers a hundred orders.

The template, filled for order 1042

The template is Give the status of order blank as JSON with the four fields named. Order 1042 fills the blank.

Give the status of order 1042 as JSON. The schema is order_number as a number, customer as a string, product as a string and status as a string. All four fields are required.

The same template, filled for order 1043

Only the order number changes. The rest of the prompt stays the same.

Give the status of order 1043 as JSON. The schema is order_number as a number, customer as a string, product as a string and status as a string. All four fields are required.

The same template, filled for order 1044

The third order fills the same blank. The shape of the answer stays the same.

Give the status of order 1044 as JSON. The schema is order_number as a number, customer as a string, product as a string and status as a string. All four fields are required.

Example

Describe the Aurora Ceramic Mug as JSON. The schema is name as a string, price as a number and dishwasher_safe as true or false. All three fields are required.

Key points

  • A template is a prompt with a blank. The blank takes a different value each time.
  • One template answers every order. The order number is the only part that changes.
  • A template keeps the wording steady. Steady wording gives steady answers.
  • The template names the shape once. Every filled answer follows the same shape.

This example runs the template filled with a product name against the local model and shows the reply it gave.

Note

Change only the blank. Change the rest of the wording only when the task changes.

Try it Yourself

Edit the code, then press Run.

Running is simulated · Rust Playground

Exercise

What is a prompt template?