-
Book Overview & Buying
-
Table Of Contents
Supercharged Coding with GenAI
By :
In this chapter, we introduced few-shot learning as a prompt engineering technique to guide LLMs toward more predictable and desired outcomes. We demonstrated its application in scenarios such as implementing a specific logging structure and following a particular coding style.
We explored how to implement few-shot prompting across different GenAI applications. In ChatGPT and OpenAI API, we utilized specific keyword combinations such as question and answer or old and refactored to structure the few-shot examples. With GitHub Copilot, we leveraged a style guide file to influence code completion output.
We also introduced additional prompt engineering techniques that are valuable for scaling bug fixes. Iterative prompting enables models to refine their output by utilizing feedback from compilation checks until the code compiles successfully. Template-based prompting leads the model toward producing outputs with a specific structure. Furthermore, CoT prompting breaks...