Intro to Prompt Engineering:
Advanced Prompts

What are Advanced Prompts?

Advanced prompts provide a lot of context and guidance to how the AI model should respond. They are usually composed of the following elements:

  • Instructions: A description of the task you want the AI model to perform. This includes the structure, style, and formatting you want the AI model to use when generating the output.
  • Examples: Additional information (inline or external) that enhances the AI model’s understanding of the task.
  • Input: The data you want the AI model to use to perform the task.

One Shot & Few Shot Prompting

You may typically see prompts referred to as “one-shot” or “few-shot.” A one-shot prompt provides a single example of the input you want the AI model to reference when performing the task; Few-shot prompts provide 2-3 examples, which helps produce even higher quality answers.

Prompt Structure

The following sections are each one prompt but contain multiple parts: instructions, examples, and input.

One-Shot

Instruction: Create a JSON object for 5 different forest animals; do not add any other properties. All properties and values should be lowercase. Only respond with the JSON object.

Example: { "name": "foxy", "species": "fox", "color": "brown", "age": 5 }

Input: Foxy, fox, brown, 5

Output
Here is a JSON object for 5 different forest animals, following the provided format:
[
    { "name": "foxy", "species": "fox", "color": "brown", "age": 5 },
    { "name": "bunny", "species": "rabbit", "color": "white", "age": 2 },
    { "name": "raccoon", "species": "raccoon", "color": "gray", "age": 3 },
    { "name": "squirrel", "species": "squirrel", "color": "gray", "age": 1 },
    { "name": "owlbert", "species": "owl", "color": "brown", "age": 7 }
]
This JSON object includes 5 different forest animals, and all properties and values are in lowercase as requested.

Few-Shot

Instruction: Create a JSON object for 5 different forest animals; do not add any other properties. All properties and values should be lowercase. Only respond with the JSON object.

Example:

input: Foxy, fox, brown, 5

output: { "name": "foxy", "species": "fox", "color": "brown", "age": 5 }

input: bunny, rabbit, white, 2

output: { "name": "bunny", "species": "rabbit", "color": "white", "age": 2 }

input: raccoon, raccoon, gray, 3

output: { "name": "raccoon", "species": "raccoon", "color": "gray", "age": 3 }

Input: squirrel, squirrel, gray, 1

What’s Next?

Now that you’ve learned the basics of prompt engineering, you are ready to start creating your own prompts and interacting with AI models. You can test out what you’ve learned by trying out our Quickstart for Beginners.

Congratulations!

You've successfully completed the tutorial.

🎉