Microsoft released a guide to prompt engineering for writing code with OpenAI's Codex
This thread covers how to:
- Guide with a Task
- Guide with Examples
- Use Zero/one/few-shot learning
- Using Contextual Information and Conversational History
I summarized the guide below 👇
1. Tell It: Guide the Model with a High Level Task Description
Start your prompt with a high-level description of what you are asking Codex to do + a specific user instruction
I.e. Ask for Python code to plot data from a standard dataset AND to import any needed libraries first
2. Show It: Guide the Model with Examples
The sequence of text that you provide in the prompt influences all of the subsequent output.
The best way to tell Codex what you want is to show it examples.
If you give Codex an example, it will imitate the example.