Best Practices for Prompting with OpenAI API and GitHub Copilot
In the concluding chapter of Part 1, we will explore how to apply best practices for crafting prompts tailored to OpenAI API and GitHub Copilot. These practices are encapsulated in the five S’s: structuring the prompt, providing surrounding context, focusing on a single task, including specific instructions, and keeping prompts short and fluff-free. While the core principles remain consistent, their application varies slightly across different GenAI tools.
We will delve into working with Python objects such as functions, classes, and methods for coding-related tasks. We will leverage the built-in inspect
package to extract key details about objects, such as their source code, docstrings, and filenames. We will also learn how to integrate this information into the system and user prompts offered by OpenAI API, combining context, task focus, and concise, structured instructions.
Additionally, we will examine...