diff --git a/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/1-introduction.yml b/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/1-introduction.yml new file mode 100644 index 00000000..f182c7e8 --- /dev/null +++ b/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/1-introduction.yml @@ -0,0 +1,28 @@ +### YamlMime:ModuleUnit +uid: | + learn.a-beginner's-guide-to-prompt-engineering-with-github-copilot.introduction +title: | + introduction +metadata: + title: | + introduction + description: "TODO this field is for search engine optimization and is not user-visible; use 2-3 complete, grammatically correct sentences to describe the unit; include relevant search keywords." + ms.date: 7/11/2023 + author: a-a-ron + ms.author: aastewar + ms.topic: interactive-tutorial +########################################################################### +### +### If your content is related to a product or service, apply one value from the either the ms.prod allowlist +### or the ms.service allowlist. You can’t use both ms.prod and ms.service. +### +### If your content isn't about a product or service, you can omit both ms.prod and ms.service. +### +### The list of approved ms.prod values is here: https://review.learn.microsoft.com/help/platform/metadata-taxonomies?branch=main#msprod +### The list of approved ms.service values is here: https://review.learn.microsoft.com/help/platform/metadata-taxonomies?branch=main#msservice +### If you need to request new values, follow the process here: https://review.learn.microsoft.com/en-us/help/platform/metadata-allowlist-requests?branch=main + ms.prod: TODO + ms.service: TODO +durationInMinutes: 1 +content: | + [!include[](includes/1-introduction.md)] \ No newline at end of file diff --git a/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/2-understanding-prompt-engineering.yml b/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/2-understanding-prompt-engineering.yml new file mode 100644 index 00000000..d35f7087 --- /dev/null +++ b/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/2-understanding-prompt-engineering.yml @@ -0,0 +1,28 @@ +### YamlMime:ModuleUnit +uid: | + learn.a-beginner's-guide-to-prompt-engineering-with-github-copilot.learning-content +title: | + learning-content +metadata: + title: | + learning-content + description: "TODO this field is for search engine optimization and is not user-visible; use 2-3 complete, grammatically correct sentences to describe the unit; include relevant search keywords." + ms.date: 7/11/2023 + author: a-a-ron + ms.author: aastewar + ms.topic: interactive-tutorial +########################################################################### +### +### If your content is related to a product or service, apply one value from the either the ms.prod allowlist +### or the ms.service allowlist. You can’t use both ms.prod and ms.service. +### +### If your content isn't about a product or service, you can omit both ms.prod and ms.service. +### +### The list of approved ms.prod values is here: https://review.learn.microsoft.com/help/platform/metadata-taxonomies?branch=main#msprod +### The list of approved ms.service values is here: https://review.learn.microsoft.com/help/platform/metadata-taxonomies?branch=main#msservice +### If you need to request new values, follow the process here: https://review.learn.microsoft.com/en-us/help/platform/metadata-allowlist-requests?branch=main + ms.prod: TODO + ms.service: TODO +durationInMinutes: 1 +content: | + [!include[](includes/2-learning-content.md)] \ No newline at end of file diff --git a/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/3-exercise.yml b/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/3-exercise.yml new file mode 100644 index 00000000..952ae4f9 --- /dev/null +++ b/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/3-exercise.yml @@ -0,0 +1,28 @@ +### YamlMime:ModuleUnit +uid: | + learn.a-beginner's-guide-to-prompt-engineering-with-github-copilot.exercise +title: | + exercise +metadata: + title: | + exercise + description: "TODO this field is for search engine optimization and is not user-visible; use 2-3 complete, grammatically correct sentences to describe the unit; include relevant search keywords." + ms.date: 7/11/2023 + author: a-a-ron + ms.author: aastewar + ms.topic: interactive-tutorial +########################################################################### +### +### If your content is related to a product or service, apply one value from the either the ms.prod allowlist +### or the ms.service allowlist. You can’t use both ms.prod and ms.service. +### +### If your content isn't about a product or service, you can omit both ms.prod and ms.service. +### +### The list of approved ms.prod values is here: https://review.learn.microsoft.com/help/platform/metadata-taxonomies?branch=main#msprod +### The list of approved ms.service values is here: https://review.learn.microsoft.com/help/platform/metadata-taxonomies?branch=main#msservice +### If you need to request new values, follow the process here: https://review.learn.microsoft.com/en-us/help/platform/metadata-allowlist-requests?branch=main + ms.prod: TODO + ms.service: TODO +durationInMinutes: 1 +content: | + [!include[](includes/3-exercise.md)] \ No newline at end of file diff --git a/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/4-learning-content.yml b/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/4-learning-content.yml new file mode 100644 index 00000000..1d85896f --- /dev/null +++ b/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/4-learning-content.yml @@ -0,0 +1,28 @@ +### YamlMime:ModuleUnit +uid: | + learn.a-beginner's-guide-to-prompt-engineering-with-github-copilot.learning-content +title: | + learning-content +metadata: + title: | + learning-content + description: "TODO this field is for search engine optimization and is not user-visible; use 2-3 complete, grammatically correct sentences to describe the unit; include relevant search keywords." + ms.date: 7/11/2023 + author: a-a-ron + ms.author: aastewar + ms.topic: interactive-tutorial +########################################################################### +### +### If your content is related to a product or service, apply one value from the either the ms.prod allowlist +### or the ms.service allowlist. You can’t use both ms.prod and ms.service. +### +### If your content isn't about a product or service, you can omit both ms.prod and ms.service. +### +### The list of approved ms.prod values is here: https://review.learn.microsoft.com/help/platform/metadata-taxonomies?branch=main#msprod +### The list of approved ms.service values is here: https://review.learn.microsoft.com/help/platform/metadata-taxonomies?branch=main#msservice +### If you need to request new values, follow the process here: https://review.learn.microsoft.com/en-us/help/platform/metadata-allowlist-requests?branch=main + ms.prod: TODO + ms.service: TODO +durationInMinutes: 1 +content: | + [!include[](includes/4-learning-content.md)] \ No newline at end of file diff --git a/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/5-exercise.yml b/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/5-exercise.yml new file mode 100644 index 00000000..f44d6ed7 --- /dev/null +++ b/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/5-exercise.yml @@ -0,0 +1,28 @@ +### YamlMime:ModuleUnit +uid: | + learn.a-beginner's-guide-to-prompt-engineering-with-github-copilot.exercise +title: | + exercise +metadata: + title: | + exercise + description: "TODO this field is for search engine optimization and is not user-visible; use 2-3 complete, grammatically correct sentences to describe the unit; include relevant search keywords." + ms.date: 7/11/2023 + author: a-a-ron + ms.author: aastewar + ms.topic: interactive-tutorial +########################################################################### +### +### If your content is related to a product or service, apply one value from the either the ms.prod allowlist +### or the ms.service allowlist. You can’t use both ms.prod and ms.service. +### +### If your content isn't about a product or service, you can omit both ms.prod and ms.service. +### +### The list of approved ms.prod values is here: https://review.learn.microsoft.com/help/platform/metadata-taxonomies?branch=main#msprod +### The list of approved ms.service values is here: https://review.learn.microsoft.com/help/platform/metadata-taxonomies?branch=main#msservice +### If you need to request new values, follow the process here: https://review.learn.microsoft.com/en-us/help/platform/metadata-allowlist-requests?branch=main + ms.prod: TODO + ms.service: TODO +durationInMinutes: 1 +content: | + [!include[](includes/5-exercise.md)] \ No newline at end of file diff --git a/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/6-knowledge-check.yml b/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/6-knowledge-check.yml new file mode 100644 index 00000000..1f46eb84 --- /dev/null +++ b/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/6-knowledge-check.yml @@ -0,0 +1,96 @@ +### YamlMime:ModuleUnit +uid: | + learn.a-beginner's-guide-to-prompt-engineering-with-github-copilot.knowledge-check +title: Knowledge check +metadata: + title: Knowledge check + description: "TODO this field is for search engine optimization and is not user-visible; use 2-3 complete, grammatically correct sentences to describe the unit; include relevant search keywords." + ms.date: 7/11/2023 + author: a-a-ron + ms.author: aastewar + ms.topic: interactive-tutorial +########################################################################### +### +### If your content is related to a product or service, apply one value from the either the ms.prod allowlist +### or the ms.service allowlist. You can’t use both ms.prod and ms.service. +### +### If your content isn't about a product or service, you can omit both ms.prod and ms.service. +### +### The list of approved ms.prod values is here: https://review.learn.microsoft.com/help/platform/metadata-taxonomies?branch=main#msprod +### The list of approved ms.service values is here: https://review.learn.microsoft.com/help/platform/metadata-taxonomies?branch=main#msservice +### If you need to request new values, follow the process here: https://review.learn.microsoft.com/en-us/help/platform/metadata-allowlist-requests?branch=main + ms.prod: TODO + ms.service: TODO +durationInMinutes: 1 +########################################################################### +### +### General guidance (https://review.docs.microsoft.com/learn-docs/docs/id-guidance-knowledge-check) +###  - Questions are complete sentences ending with a question mark +###  - No true/false questions +###  - 3 answers per question +###  - All answers about the same length +###  - Numeric answers listed in sorted order +###  - No "All of the above" and/or "None of the above" as answer choices +###  - No "Not" or "Except" in questions +###  - No second person ("you") in the questions or answers +###  - Provide a meaningful explanation for both correct and incorrect answers +### +########################################################################### +content: | +quiz: + questions: + - content: "" + choices: + - content: "" + isCorrect: true + explanation: "" + - content: "" + isCorrect: false + explanation: "" + - content: "" + isCorrect: false + explanation: "" + - content: "" + choices: + - content: "" + isCorrect: true + explanation: "" + - content: "" + isCorrect: false + explanation: "" + - content: "" + isCorrect: false + explanation: "" + - content: "" + choices: + - content: "" + isCorrect: true + explanation: "" + - content: "" + isCorrect: false + explanation: "" + - content: "" + isCorrect: false + explanation: "" + - content: "" + choices: + - content: "" + isCorrect: true + explanation: "" + - content: "" + isCorrect: false + explanation: "" + - content: "" + isCorrect: false + explanation: "" + - content: "" + choices: + - content: "" + isCorrect: true + explanation: "" + - content: "" + isCorrect: false + explanation: "" + - content: "" + isCorrect: false + explanation: "" \ No newline at end of file diff --git a/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/7-summary.yml b/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/7-summary.yml new file mode 100644 index 00000000..535ac05b --- /dev/null +++ b/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/7-summary.yml @@ -0,0 +1,28 @@ +### YamlMime:ModuleUnit +uid: | + learn.a-beginner's-guide-to-prompt-engineering-with-github-copilot.summary +title: | + summary +metadata: + title: | + summary + description: "TODO this field is for search engine optimization and is not user-visible; use 2-3 complete, grammatically correct sentences to describe the unit; include relevant search keywords." + ms.date: 7/11/2023 + author: a-a-ron + ms.author: aastewar + ms.topic: interactive-tutorial +########################################################################### +### +### If your content is related to a product or service, apply one value from the either the ms.prod allowlist +### or the ms.service allowlist. You can’t use both ms.prod and ms.service. +### +### If your content isn't about a product or service, you can omit both ms.prod and ms.service. +### +### The list of approved ms.prod values is here: https://review.learn.microsoft.com/help/platform/metadata-taxonomies?branch=main#msprod +### The list of approved ms.service values is here: https://review.learn.microsoft.com/help/platform/metadata-taxonomies?branch=main#msservice +### If you need to request new values, follow the process here: https://review.learn.microsoft.com/en-us/help/platform/metadata-allowlist-requests?branch=main + ms.prod: TODO + ms.service: TODO +durationInMinutes: 1 +content: | + [!include[](includes/7-summary.md)] \ No newline at end of file diff --git a/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/includes/1-introduction.md b/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/includes/1-introduction.md new file mode 100644 index 00000000..d8a47c35 --- /dev/null +++ b/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/includes/1-introduction.md @@ -0,0 +1,62 @@ + +TODO: add your topic sentences(s) +TODO: add a visual element + + +## Example scenario +TODO: add your scenario +TODO: add a visual element + + +## What will we be doing? +TODO: add your activities + + +## What is the main goal? +By the end of this session, you'll be able to (TODO) + + \ No newline at end of file diff --git a/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/includes/2-understanding-prompt-engineering.md b/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/includes/2-understanding-prompt-engineering.md new file mode 100644 index 00000000..7b1424a1 --- /dev/null +++ b/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/includes/2-understanding-prompt-engineering.md @@ -0,0 +1,111 @@ +:::image type="content" source="../media/prompt-engineering-header.png" alt-text="REPLACE-ME"::: + +GitHub Copilot and other Generative AI coding tools are transforming the way developers approach daily coding tasks. From documenting your codebases to generating unit tests, these tools are helping to accelerate your workflows. However, just like with any emerging tech, there’s always a learning curve. As a result, it can sometimes feel frustrating when AI-powered coding assistants don’t generate the output you want. + +It's not uncommon to feel frustrated when you don't receive the expected results, and then see examples of other developers being successful using these same tools. For example, someone using GitHub Copilot for the first time may ask it to solve a problem or provide a solution to a specific coding question only to get back an incongruent suggestion or no suggestion at all. This can be discouraging and can result in many hours tinkering with the tool and then feeling lucky if you got what you're looking for. But, as it turns out, these discouraging situations are most likely a result of using the tool wrong. In fact, there is a concept called prompt engineering that we'll explore in this module, and by using best practices, you'll be able to more accurately get the results and code suggestions you're looking for. + +But, before we dive into these best practices, let's start with the basics of GitHub Copilot and prompt engineering. + +## What is GitHub Copilot? + +GitHub Copilot is an AI pair programmer developed by GitHub. It's powered by the OpenAI Codex, a generative pre-trained language model created by OpenAI and provides contextualized code suggestions based on context from comments and code. To use it, you can install the GitHub Copilot extension available to you in the following Integrated Development Environments (IDEs): + +- Visual Studio +- Visual Studio Code +- Neovim +- JetBrains IDEs (IntelliJ, PyCharm, WebStorm, etc) + +Under the hood, GitHub Copilot draws context from comments and code, instantly suggesting individual lines and whole functions. + +## What is prompt engineering? + +Prompt engineering is the practice of giving an AI model specific instructions to produce the results you want. A prompt is a sequence of text or a line of code that can trigger a response from an AI model. These AI models will only do what you tell them to do, so the more specific the instructions the better the results will be. Being vague or simple in your instructions will often provide a wide variety of undesired results. + +Then same concept is true in everyday situations. For example, if you asked someone to make you a sandwich and the only instructions you gave them was, "Make me a sandwich", then it's very likely you'll get a sandwich that you didn't want. However, if instead you gave them a series of specific steps or instructions, you can get closer to your desired outcome. So, If you wanted a turkey, bacon, and avocado sandwich, you could get closer to your desired outcome with the following prompt. + +- Open the bag of wheat bread and take two slices of the bread out of the bag +- Lay the slices of bread side by side on the table +- Place two slices of turkey on one slice of bread +- On the same slice of bread, place two pieces of cooked bacon +- And so on... + +Without these detailed instructions, the desired outcome can be disappointing and frustrating. Similarly, GitHub Copilot needs clear, step-by-step instructions to generate the code that best helps you and provide you with your desired outcome. + +For a more code specific example, let's see what this would look like using p5.js, which is a JavaScript library for creative coding and is a fun way to create images with code. + +### Using basic prompts + +Using p5.js, let's say we want to create an image of a boat sailing on the ocean. Let's use GitHub Copilot to create an image of our boat using a basic prompt. + +` +// draw a brown wooden boat on top of a blue ocean with a sun. +` + +GitHub Copilot returns with the following code for the image. It's somewhat relevant but it's hard to tell what's going on. The image looks more like a house or some structure instead of our desired boat. We can do better. + +:::image type="content" source="../media/simple-prompt.png" alt-text="REPLACE-ME"::: + +Basics prompts such as this often return irrelevant suggestions—or sometimes no suggestions at all. As you learn how GitHub Copilot processes information, you can adjust the way you communicate with it and adjust your prompt to generate more accurate results. Let's try this again, but with a better prompt. + +### Using detailed prompts + +When prompting GitHub Copilot, think of the process as having a conversation with someone: How should I break down the problem so we can solve it together? How would I approach pair programming with this person? + +Let's expand on the above basic prompt and provide GitHub Copilot a big picture description of what we want it to generate by using the prompt below. + +``` +/* draw a brown wooden boat with a white sail on top of a blue ocean. +- The sky is light blue with one white cloud. +- The cloud has three different sized circles that overlap each other. +- The sun is a yellow circle inside a yellow-orange circle inside an orange circle in the top right corner. +- The sail is a large white triangle connected to the top of the dark brown mast down to the tip of the front of the boat. +- The boat is curved at the bottom and has a dark brown rectangle for the body. +*/ +``` + +With the better defined prompt, GitHub Copilot was able to more accurately provide a result that we were looking for. + +:::image type="content" source="../media/detailed-prompt.png" alt-text="REPLACE-ME"::: + +When you provide specific details, GitHub Copilot will be able to generate more accurate code suggestions. For example, if you want GitHub Copilot to retrieve data from an API, you need to tell it what type of data you want to retrieve, how to process the data, and what API endpoint you're hoping to hit. + +In addition to providing detailed prompts, there are some best practices to keep in mind to further improve GitHub Copilot's ability to more accurately provide you with the best results. Here are 6 best practices for prompt crafting with GitHub Copilot. + +## 6 best practices for prompt crafting with GitHub Copilot + +We've seen the impact that detailed prompts can have with our desired outcome, but let's take this further and look at 6 best practices for crafting prompts using GitHub Copilot. + +### 1. Set the stage with a high-level goal + +This is most helpful if you have a blank file or empty codebase. In other words, if GitHub Copilot has zero context of what you want to build or accomplish, setting the stage for the AI pair programmer can be really useful. It helps to prime GitHub Copilot with a big picture description of what you want it to generate—before you jump in with the details. + +When prompting GitHub Copilot, think of the process as having a conversation with someone: How should I break down the problem so we can solve it together? How would I approach pair programming with this person? + +### 2. Make your ask simple and specific + +Once you communicate your main goal to the AI pair programmer, articulate the logic and steps it needs to follow for achieving that goal. GitHub Copilot better understands your goal when you break things down. (Going back to the sandwich example, break the process down into discrete steps, don't write a paragraph describing the sandwich you want to make.) + +In addition, let GitHub Copilot generate the code after each step, rather than asking it to generate a bunch of code all at once. + +### 3. Give GitHub Copilot an example or two + +Learning from examples is not only useful for humans, but also for your AI pair programmer. In addition to telling GitHub Copilot what you want it to do, you can also show it what you want it to do with examples in your preferred coding style. While GitHub Copilot is using an AI model that is already trained on a large amount of data, providing examples to GitHub Copilot help it understand the context and constraints of a particular code snippet. Showing AI models examples of what you want them to do is a common practice in machine learning. + +### 4. Experiment and iterate with your prompts + +If your initial prompt provides an unrelevant solution, delete the generated code suggestion, edit your comment with more details and examples, and try again! It's a learning process for you and GitHub Copilot. The more you use it, the better you'll get at communicating with GitHub Copilot. Just how conversation is more of an art than a science, so is prompt crafting. So, if you don’t receive what you want on the first try, recraft your prompt by following these best practices. + +### 5. Keep a tab opened of relevant files in your IDE + +GitHub doesn't have an exact number of tabs that you should keep open to help GitHub Copilot contextualize your code, but from users experience, it's reported that one or two is helpful. + +GitHub Copilot uses a technique called neighboring tabs that allows the AI pair programmer to contextualize your code by processing all of the files open in your IDE instead of just the single file you’re working on. However, it’s not guaranteed that GitHub Copilot will deem all open files as necessary context for your code. + +### 6. Use good coding practices + +While GitHub Copilot can be a powerful tool for generating code suggestions, it's important to remember that it's not a replacement for your own programming skills and expertise. AI models are only as good as the data they have been trained on, Therefore, it's important to use these tools as aids and not rely on them entirely. It's important for you to still perform the following tasks when using GitHub Copilot: + +- Review the code suggestions +- Run unit tests +- Manually test the code suggestions to ensure they work as intended +- Continue to use good coding practices. GitHub Copilot will adapt to follow your coding style and patterns as a guide when providing suggestions diff --git a/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/includes/3-data-flow.md b/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/includes/3-data-flow.md new file mode 100644 index 00000000..de93efd5 --- /dev/null +++ b/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/includes/3-data-flow.md @@ -0,0 +1,59 @@ +:::image type="content" source="../media/data-flow.png" alt-text="REPLACE-ME"::: + +Now that we've covered the basics of prompt engineering, let's take a closer look at how GitHub Copilot works under the hood and better understand the inbound and outbound data flow that occurs when you initiate a prompt. + +Using the above image for reference, GitHub Copilot's data flow can be dissected into the following steps; + +- 1. Prompt is sent from the text editor to a proxy service +- 2. Synthesize solutions using the OpenAI Model +- 3. An array of prompt suggestions are sent back to the Copilot proxy service + +## Step 1: Prompts are sent from the text editor to a proxy service + +Because GitHub Copilot is based on the use of a plugin within your text editor, GitHub Copilot is scoped to your local environment within that text editor. It doesn't look at your Git repositories, your file systems, or any open browsers. However, if you have open files within your text editor, GitHub Copilot does look at those open files for context to better understand your code to provide you with more accurate suggestions. + +When a prompt is sent from your text editor, GitHub Copilot will first look at the main open file and notice where your cursor is positioned within that file. Copilot will then pull a window of roughly 400 characters before and after your cursor, evaluate the code within that window, and then look at any open tabs within your text editor to see if there is anything useful it can reference to give a better prompt suggestion. + +A common example of this is writing unit tests. If you're writing unit tests in one file, and the file you're testing is in an adjacent tab, GitHub Copilot will evaluate the initial code in the main file around your cursor, look at the code in that adjacent tab for additional context, and then use all of that information to provide you a better prompt suggestion. + +### Encrypted data + +It's important to note that all of this data is encrypted before it is sent over to the proxy service. The prompt is sent over HTTPS using TLS 1.2/1.3, the same secure method if you were to make a purchase with an online retailor. + +### Copilot Proxy Service + +The proxy service is run in a GitHub owned Azure tenant. GitHub controls this proxy service and sets the specifications on how it runs the pre and post processing of the code that goes through the proxy service through a prompt. On the pre-processing side, once the prompt has been encrypted and it's been received by the proxy, the proxy service will decrypt the data, keep it in ram for processing, and filter the data for sensitive and inappropriate information while also running Microsoft's responsible AI toxicity filter. Here are some key items that will be filtered out through the proxy service that will be stripped out or ignored; + +- Personally identifiable information (PII) + - IP addresses, email addresses, specific GitHub URLs +- Toxicity data + - Hate speech, inappropriate words, abusive use of prompts, etc. + +In addition to the filtering that takes place, the proxy service also runs a code classifier based on the prompt data. For example, is it code that the user wants back? If it is, what kind? Are the files in Java, Python, or something else? All of this information is what the proxy service is doing on the front end. Once this pre-processing is done, it remains in ram and nothing is ever stored at rest. It then gets re-encrypted and sent to the model. + +## Step 2: Synthesize solutions using the OpenAI Model + +GitHub Copilot is powered by a generative AI model developed by GitHub, OpenAI, and Microsoft. GitHub Copilot is trained on all languages that appear in public repositories. For each language, the quality of suggestions you receive may depend on the volume and diversity of training data for that language. You can think of this model as performing applied statistics instead of just copying and pasting code as a prompt suggestion. The model is taking everything that was passed from the proxy service and essentially breaking it down into small bits of information called tokens. For example, if you were to take a sentence, pretend that each word is a token and the model is mapping each token's proximity to every other token that it sees, and using that data to provide the response. + +Let's look at another example using Java. If the prompt starts with `public`, most of the time the next word is going to be `class`. Statistically, if you have a public class, most of the time the next thing is going to be a variable name defining that class. + +```java +public class MyClass { + // Class members and methods go here +} +``` + +Using another Java example, if the prompt reads `public static`, most of the time you know that the next thing is going to be `void main`, because that is the typical language for a Java main method and is what you would expect to see as the return prompt suggestion. + +```java +public static void main(String[] args){ + // Program execution starts here + // Your Java code goes here +} +``` + +In general, the model is looking at the prompt that it was provided and then evaluating the statistically most likely prompt response back to the user based on the series of tokens that it was given. As this model receives more training, the responses become more accurate and the model can better predict your desired outcome. + +So that's essentially what this model is doing. It gets this encrypted prompt from the proxy service that's gone through this pre-processing scrub, decrypting it, and running it's token analysis before returning the prompt response back to the proxy service. That is the inbound data flow. These next steps go over the outbound data flow where everything goes back in the other direction. + +### An array of prompt suggestions are sent back to the Copilot proxy service \ No newline at end of file diff --git a/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/includes/4-learning-content.md b/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/includes/4-learning-content.md new file mode 100644 index 00000000..ed3dc218 --- /dev/null +++ b/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/includes/4-learning-content.md @@ -0,0 +1,78 @@ + +TODO: add your topic sentences(s) + + +TODO: add your scenario sub-task + + +TODO: write your prose table-of-contents + + +TODO: add a visual element + + + + +## H2 heading +Strong lead sentence; remainder of paragraph. +Paragraph (optional) +Visual (image, table, list, code sample, blockquote) +Paragraph (optional) +Paragraph (optional) + + +## H2 heading +Strong lead sentence; remainder of paragraph. +Visual (image, table, list) +### H3 heading +Strong lead sentence; remainder of paragraph. +Paragraph (optional) +Visual (image, table, list) +Paragraph (optional) +### H3 heading +Strong lead sentence; remainder of paragraph. +Paragraph (optional) +Visual (image, table, list) +Paragraph (optional) + + + + \ No newline at end of file diff --git a/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/includes/5-exercise.md b/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/includes/5-exercise.md new file mode 100644 index 00000000..4ed600b3 --- /dev/null +++ b/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/includes/5-exercise.md @@ -0,0 +1,104 @@ + +TODO: add your topic sentences(s) + + +TODO: add your scenario sub-task +TODO: add your scenario image + + +TODO: describe the end-state + + + +## (Chunk 1 heading) + +1. +1. +1. + +## (Chunk 2 heading) + +1. +1. +1. + +## (Chunk n heading) + +1. +1. +1. + + + +## Check your work + +1. +1. +1. +Optional "exercise-solution" video + + + + diff --git a/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/includes/7-summary.md b/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/includes/7-summary.md new file mode 100644 index 00000000..9e55e9a2 --- /dev/null +++ b/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/includes/7-summary.md @@ -0,0 +1,69 @@ + +TODO: restate the scenario problem + + +TODO: add your lead-in sentence(s) +TODO: add your list of techniques used to solve the scenario problem + + +TODO: describe the experience without the product + + +TODO: describe the business impact + + + + diff --git a/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/index.yml b/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/index.yml new file mode 100644 index 00000000..3fbbcf2a --- /dev/null +++ b/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/index.yml @@ -0,0 +1,62 @@ +### YamlMime:Module +uid: | + learn.a-beginner's-guide-to-prompt-engineering-with-github-copilot +metadata: + title: | + A beginner's guide to prompt engineering with GitHub Copilot + description: "TODO this field is for search engine optimization and is not user-visible; use 2-3 complete, grammatically correct sentences to describe the module; include relevant search keywords." + ms.date: 7/11/2023 + author: a-a-ron + ms.author: aastewar + ms.topic: module-standard-task-based # Please don't edit, used for our analytics +########################################################################### +### +### If your content is related to a product or service, apply one value from the either the ms.prod allowlist +### or the ms.service allowlist. You can’t use both ms.prod and ms.service. +### +### If your content isn't about a product or service, you can omit both ms.prod and ms.service. +### +### The list of approved ms.prod values is here: https://review.learn.microsoft.com/help/platform/metadata-taxonomies?branch=main#msprod +### The list of approved ms.service values is here: https://review.learn.microsoft.com/help/platform/metadata-taxonomies?branch=main#msservice +### If you need to request new values, follow the process here: https://review.learn.microsoft.com/en-us/help/platform/metadata-allowlist-requests?branch=main + ms.prod: TODO + ms.service: TODO +title: | + A beginner's guide to prompt engineering with GitHub Copilot +summary: "TODO 2 sentences, 20-35 words, don't teach or motivate, avoid using 'learn', don't duplicate the title; see https://review.docs.microsoft.com/help/learn/id-guidance-introductory-summaries?branch=main" +abstract: | + By the end of this module, you'll be able to: + - "TODO learning objective 1" + - "TODO learning objective 2" + - "TODO learning objective 3 (if needed; see https://review.docs.microsoft.com/help/learn/id-guidance-learning-objectives?branch=main)" +prerequisites: | + - "TODO prerequisite 1" + - "TODO prerequisite 2" + - "TODO prerequisite 3 (if needed; see https://review.docs.microsoft.com/help/learn/id-guidance-prerequisites?branch=main" +iconUrl: /learn/achievements/generic-badge.svg +levels: # see level taxonomy https://review.docs.microsoft.com/help/contribute/metadata-taxonomies?branch=main#level + - TODO +roles: # see role taxonomy https://review.docs.microsoft.com/help/contribute/metadata-taxonomies?branch=main#role + - TODO +products: # see product taxonomy https://review.docs.microsoft.com/help/contribute/metadata-taxonomies?branch=main#product +- github +subjects: # see subject taxonomy https://review.docs.microsoft.com/help/contribute/metadata-taxonomies?branch=main#subject + - TODO +units: +- learn.a-beginner's-guide-to-prompt-engineering-with-github-copilot +.introduction +- learn.a-beginner's-guide-to-prompt-engineering-with-github-copilot +.learning-content +- learn.a-beginner's-guide-to-prompt-engineering-with-github-copilot +.exercise +- learn.a-beginner's-guide-to-prompt-engineering-with-github-copilot +.learning-content +- learn.a-beginner's-guide-to-prompt-engineering-with-github-copilot +.exercise +- learn.a-beginner's-guide-to-prompt-engineering-with-github-copilot +.knowledge-check +- learn.a-beginner's-guide-to-prompt-engineering-with-github-copilot +.summary +badge: + uid: | + learn.a-beginner's-guide-to-prompt-engineering-with-github-copilot.badge \ No newline at end of file diff --git a/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/media/detailed-prompt.png b/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/media/detailed-prompt.png new file mode 100644 index 00000000..7634a8bb Binary files /dev/null and b/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/media/detailed-prompt.png differ diff --git a/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/media/prompt-engineering-header.png b/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/media/prompt-engineering-header.png new file mode 100644 index 00000000..95b475c0 Binary files /dev/null and b/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/media/prompt-engineering-header.png differ diff --git a/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/media/simple-prompt.png b/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/media/simple-prompt.png new file mode 100644 index 00000000..908434ba Binary files /dev/null and b/github/a-beginner's-guide-to-prompt-engineering-with-github-copilot/media/simple-prompt.png differ