From the course: AWS Certified AI Practitioner (AIF-C01) Cert Prep

Unlock this course with a free trial

Join today to access over 24,700 courses taught by industry experts.

Prompt engineering techniques

Prompt engineering techniques

- There are different techniques for executing prompt engineering, and we're going to describe some of them by using a real world scenario. And so our description for this scenario is just to use different techniques to create a python function, which calculates the factorial of a number, which is a relatively simple task. Our first technique is zero-shot prompting. And this is where the user asks the model to perform a task without any prior examples or context. And so our initial prompt might look something like this, write a python function to calculate the factorial of a number. Very simple, very direct. And we get a code result that works fine on the first try. And there might be extra stuff in there that we didn't ask for, like the example usage. Some code generators will add comments, but the code works. What else can we do? There's single-shot prompting where we provide a single example to guide the model's response to a prompt. And so our prompt now looks like this, create a…

Contents