Skip to content

Commit c9b8c7c

Browse files
authored
Features/add vision for copilot lesson (#22)
2 parents 654b0f3 + c8e7244 commit c9b8c7c

File tree

5 files changed

+69
-62
lines changed

5 files changed

+69
-62
lines changed

docs/1-installing-copilot.md

+33-62
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
**Goal:**
66
In this lab, you will learn how to install:
77

8-
- GitHub Copilot extension in Visual Studio Code
8+
- GitHub Copilot extensions in Visual Studio Code
99
- GitHub Copilot CLI
1010

1111
**Estimated Duration:**
@@ -19,59 +19,39 @@ In this lab, you will learn how to install:
1919
- Installed Visual Studio Code,
2020
- GitHub Copilot subscription.
2121

22-
---
23-
24-
## Table of Contents
25-
26-
1. [Lab Objectives](#lab-objectives)
27-
2. [Environment Setup](#environment-setup)
28-
3. [Walkthrough](#walkthrough)
29-
- [Step 1: Install GitHub Copilot in VS Code](#step-1-install-github-copilot-in-vs-code)
30-
- [Step 2: Install GitHub CLI](#step-2-install-github-cli)
31-
- [Step 3: Install GitHub CLI Copilot Extension](#step-3-install-github-cli-copilot-extension)
32-
4. [Verification](#verification)
33-
5. [Troubleshooting](#troubleshooting)
34-
6. [Conclusion](#conclusion)
35-
36-
---
37-
38-
## Lab Objectives
39-
40-
- Install GitHub Copilot in Visual Studio Code.
41-
- Install GitHub Copilot CLI.
42-
43-
---
44-
45-
## Environment Setup
22+
## Install GitHub Copilot in VS Code
4623

47-
### Tools and Resources
48-
49-
- GitHub Copilot enabled on your GitHub account.
50-
- Visual Studio Code installed.
51-
52-
---
53-
54-
## Walkthrough
55-
56-
### Step 1: Install GitHub Copilot in VS Code
57-
58-
**Description:**
59-
You will install GitHub Copilot and GitHub Copilot Chat Visual Studio Code extensions.
60-
61-
**Instructions:**
24+
First, we will install GitHub Copilot and its corresponding Visual Studio Code extensions.
6225

6326
1. Open Visual Studio Code.
64-
2. Open Extensions view by clicking the Extensions icon in the Activity Bar.
65-
3. Enter 'GitHub Copilot' in the Search Extensions in Marketplace field.
27+
2. Open Extensions view by clicking the Extensions icon in the Activity Bar
28+
3. Enter 'GitHub Copilot' in the Search Extensions in Marketplace.
6629
4. Click Install button on the **GitHub Copilot** extension by GitHub.
6730
Wait until GitHub Copilot is installed.
6831
It will also install **GitHub Copilot Chat** by GitHub extension.
69-
5. While the Extensions view is still open, find **GitHub Copilot for Azure** by Microsoft and click Install.
70-
With this extension installed, you can ask @azure questions about Azure services and get help with tasks related to Azure.
71-
6. (Optional) In the Search Extensions in Marketplace field, enter "Vision", find **Vision for Copilot Preview** by Microsoft and click Install.
72-
This extension enhances chat interactions by enabling users to leverage advanced vision capabilities, such as including images with your prompts to GitHub (a picture is worth a thousand words?).
73-
7. (Optional) In the Search Extensions in Marketplace field, enter "Voice", find **VS Code Speech** by Microsoft and click Install.
74-
This extension adds speech-to-text and text-to-speech capabilities to Visual Studio Code in general, but can also let you interact with GitHub Copilot using natural language speech.
32+
5. Next, we will install the following Copilot Extensions that are needed for the remainder of the training:
33+
- **Install GitHub Copilot for Azure**
34+
- While in the Extensions view, search for **GitHub Copilot for Azure** by Microsoft.
35+
- Click the **Install** button.
36+
- With this extension, you can ask **@azure** questions about Azure services and receive assistance with Azure-specific tasks.
37+
- **Install VS Code Speech (Optional)**
38+
- In the **Search Extensions in Marketplace** field, type **Voice**.
39+
- Locate the **VS Code Speech** extension by Microsoft and click the **Install** button.
40+
- This extension adds speech-to-text and text-to-speech functionality, allowing you to interact with GitHub Copilot using natural language speech.
41+
- **Install Vision for Copilot Preview (Optional)**
42+
- In the **Search Extensions in Marketplace** field, type **Vision**.
43+
- Locate the **Vision for Copilot Preview** extension by Microsoft and click the **Install** button.
44+
- This extension enables advanced vision capabilities, allowing you to include images in your prompts for enhanced interactions with GitHub Copilot.
45+
- >**Note**: This feature requires an Open AI Service and access credentials.
46+
- After installing the extension, update your Visual Studio Code settings:
47+
- Open the Command Palette (`Ctrl+Shift+P`) and type **Preferences: Open Settings (JSON)**.
48+
- Add the following parameters to your `settings.json` file:
49+
50+
```json
51+
"copilot.vision.azureEndpoint": "<your instructor will provide an endpoint>",
52+
"copilot.vision.provider": "AzureOpenAI",
53+
"copilot.vision.model": "gpt-4o"
54+
```
7555

7656
**Expected Outcome:**
7757
Both GitHub Copilot and GitHub Copilot Chat extensions are installed in Visual Studio Code.
@@ -90,17 +70,13 @@ For other platforms, see the instructions [here](https://github.com/cli/cli?tab=
9070
1. Open Visual Studio Code shell (Ctrl-`).
9171
2. In the Visual Studio Code terminal window, enter the following command:
9272

93-
```bash
94-
winget install --id GitHub.cli
95-
```
73+
winget install --id GitHub.cli
9674

9775
3. Once GitHub CLI installation completes, login to GitHub:
9876

99-
```bash
100-
gh auth login
101-
```
77+
gh auth login
10278

103-
When prompted, select the following options by using the arrows keys and pressing Enter and follow the instructions:
79+
4. When prompted, select the following options by using the arrows keys and pressing Enter and follow the instructions:
10480

10581
- Where do you use GitHub? **GitHub.com**
10682
- What is your preferred protocol for Git operations on this host? **HTTPS**
@@ -124,10 +100,7 @@ You will install GitHub Copilot extension to GitHub CLI (_gh_).
124100

125101
1. In the Visual Studio Code terminal window, enter the following command:
126102

127-
```bash
128-
gh extension install github/gh-copilot
129-
130-
```
103+
gh extension install github/gh-copilot
131104

132105
**Expected Outcome:**
133106
GitHub Copilot extension to GitHub CLI is installed.
@@ -138,9 +111,7 @@ GitHub Copilot extension to GitHub CLI is installed.
138111

139112
1. Test the installed Copilot extension to GitHub CLI.
140113

141-
```bash
142-
gh copilot --help
143-
```
114+
gh copilot --help
144115

145116
2. Read the response and try suggested examples.
146117

docs/2-development-with-copilot.md

+11
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,17 @@ Refactor the GetTotal method to include taxes and discounts. get the taxes from
110110

111111
You will notice that instead of generating code snippets like `Inline Chat`, copilot edits parses the entire Order class and modifies the logic accordingly.
112112

113+
## Copilot Vision (Preview)
114+
115+
GitHub Copilot Vision enhances your workflow by enabling image-based prompts and visual context for smarter code suggestions. In this step, we will enhance code tied to visual components like HTML `<img>` tags.
116+
117+
1. Open the file `samples/eShop/src/HybricApp/wwwroot/test.html' in Visual Studio Code.
118+
2. You will notice a img tag that currently has incorrect `alt` tag value.
119+
3. Click on the refactor icon ![alt text](image.png) and select `Fix with Copilot`.
120+
>*Note*: The first time you select this option, you will be prompted to provide API Key for Azure Open AI Service. You instructure will provide that information.
121+
4. Once you enter the API key, you should see an `alt` text with description of the image.
122+
5. Review the suggested fixes or enhancements for the image tag and apply them as needed.
123+
113124
## Copilot CLI
114125

115126
GitHub Copilot CLI offers an efficient way to interact with Copilot directly from the command line. With Copilot CLI, you can generate shell commands and automate tasks with ease, making it a powerful tool for developers who prefer working in a terminal environment.

docs/image.png

4.2 KB
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Test Page</title>
7+
<link rel="stylesheet" href="css/test.css">
8+
</head>
9+
<body>
10+
<header>
11+
<img alt="fix me" src="images/company-logo.png" />
12+
13+
<h1>Welcome to the Test Page</h1>
14+
</header>
15+
<main>
16+
<section>
17+
<h2>Section Title</h2>
18+
<p>This is a paragraph in the test page.</p>
19+
</section>
20+
</main>
21+
<footer>
22+
<p>&copy; 2023 eShop</p>
23+
</footer>
24+
</body>
25+
</html>

0 commit comments

Comments
 (0)