Instruction 01

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

ChatGPT Prompt Engineering

Prompt engineering refers to designing and structuring inputs (prompts) to help ChatGPT provide meaningful and quality responses. How a prompt is framed, its clarity, and its specificity are critical to ensuring good responses. To write a good prompt, you should:

Example Prompt 1

Provided the above-mentioned advice on writing good prompts, consider a few bad prompt examples and look at better alternatives:

Example Prompt 2

  Bad prompt: “What should I do?”

Example Prompt 3

Bad prompt: “What can you tell me about technology and how it affects everyone, like businesses, people, and governments, and maybe in the future too?”

Example Prompt 4  

Bad Prompt: “Help me rewrite this code.”

func sumOfNumbers(_ numbers: [Int]) -> Int {
  var sum = 0
  for value in numbers {
    sum = sum + value
  }
  return sum
}

Iterating and Prompt Variations

The best way to create good prompts is to iterate until ChatGPT provides a response in the form you’d like.

See forum comments
Download course materials from Github
Previous: Introduction Next: Instruction 02