back to indexGitHub Copilot: The World's Most Widely Adopted AI Developer Tool

00:00:00.000 |
so good morning everybody there we go my name is Dave Burnison I'm a senior devops advocate with 00:00:20.040 |
github and I want to talk today about github copilot and demo a little bit of everything that 00:00:29.100 |
copilot is today because it has the capabilities have grown a lot now over the last two three years 00:00:38.340 |
so how many how many of you are using github copilot today okay looks like half to two-thirds 00:00:46.140 |
kind of a thing kind of a ratio or so here so yeah as we get started we can see github copilot started 00:00:55.080 |
out just as generating code in the IDE with copilot individual then we launched copilot business into GA 00:01:04.320 |
shortly after that year and a half ago I guess that would be we launched copilot chat so now not only 00:01:13.560 |
could you ask copilot to generate code for you but you could take somebody's existing code maybe they 00:01:21.600 |
didn't write very good comments in their code shocker right say hey copilot explain that code to me or help 00:01:27.800 |
let me simplify that code so many more ways to use github copilot and then just this february we launched github copilot 00:01:37.040 |
enterprise being able to not only use copilot in your IDE of choice but also right on github.com itself have copilot help you generate pull request summaries 00:01:37.040 |
have copilot help you generate pull request summaries or tap into information that may be stored in your knowledge bases and ask copilot questions and things like that and use a lot of the same chat features right there and I'll also talk about some of the things that were 00:01:45.040 |
launching right now we've got in beta and technical preview and such so I think we're launching right now we've got in beta and technical preview and such 00:01:51.040 |
so I think we're launching a lot of the things that we're launching right now and we've got in beta and technical preview and such so I think we're going to talk about some of the 00:01:59.040 |
things that we're launching right now we've got in beta and technical preview and such so I think we're going to talk about some of the things that we're launching right now we've got in beta and technical preview and such 00:02:14.040 |
Github copilot is there to be your AI pair programmer help you generate code based on comments and things now the thing about copilot individual and copilot business it lives and runs as extensions in visual studio code 00:02:31.040 |
Github code spaces which is visual studio code running inside the browser the JetBrains IDEs like PyCharm and IntelliJet 00:02:40.040 |
and visual studio and a key thing about this is it doesn't actually matter where your code lives right the code hopefully lives on github github enterprise cloud but the code could live in bitbucket or azure devops even in team foundation version control it doesn't even have to be get based version control and you can still take advantage of everything that copilot business and copilot individual have to offer 00:03:09.040 |
So I am going to play through a little video of the basics here because there's a couple of things I want to point out this is just two minute video 00:03:16.040 |
Let's see how copilot can make me a more productive developer I'm using Django Python which like most programming languages and frameworks is supported by copilot Django is a framework for creating line to business applications and the first step is to create my model classes which is typically tedious what I'm going to do instead is describe using natural language what I need my model to look like that gray italicized text is going to look at the 00:03:43.040 |
That gray italicized text is co-pilot generating the appropriate code it creates the class definition and the full class across multiple lines of code copilot is also context aware it saw the fact that I created a speaker class and once again goes well speakers need to do something and it generates a talk class for me that entire class all of those lines of code was generated for me 00:04:12.040 |
There was one thing I didn't necessarily want here which is it's allowing for speakers and talks all to be deleted I want to modify that so I go back to copilot ask it for a new suggestion and it generates one 00:04:30.040 |
Finally I want to add on a code for the talk which matches a particular pattern normally at this point I would go running off to stack overflow to look up how to write this regular expression instead I describe in natural language what that pattern is supposed to look like and copilot generates all of the appropriate code for me this allows me to stay in the zone and focus in on the more 00:04:59.040 |
More important aspects of writing code all right now I know that's a very basic demo and most of you who are using copilot have seen it and used it in this way but still there's some key things to point out here it's called github copilot it's not called github autopilot you know this is not going to replace developers we still need that person in the middle and there was a great example here of that you know when it generated 00:05:28.040 |
In the talk class initially it was allowing speakers to be deleted even when talks existed so he wiped out that line he continued the conversation with copilot added that additional comment to say hey no don't allow speakers to be deleted when talks exist and then he was able to get you know exactly what he needed in this case 00:05:56.040 |
Now another thing there's there's actually an opportunity here in this even in this little demo to talk about prompt crafting or prompt engineering you know when he was adding this talk code he didn't just say add a talk code he was more specific right he said with a format of three letters a dash and three numbers and that allowed him to get back the regular expression that he needed 00:06:25.040 |
So that he needed so that you know part of prompt crafting is that specificity in your comments in your requests and things but another key element here is he was able to stay in the flow he didn't have to leave the IDE and go to find some regular expression documentation or do a google search or anything like that to figure out that syntax he got that in a matter of seconds so you can see in a second actually you know so you can see 00:06:53.040 |
just how much this can improve productivity and keep you in the flow and things like that now next we look oh so here's some at the end I'll have a link where you can find a lot of these resources and things and at some point after this session I'll put a PDF up there so you've also got all of these links and things but we've got several resources now to learn about prompt crafting 00:07:21.040 |
You know this is not something where you need a week long boot camp or anything like that just an hour or two of you know it will take less than an hour to understand prompt crafting but then just kind of playing around with it yourself to get a better feel how do you get more accurate suggestions for the context that you're in and everything. 00:07:42.040 |
And then next we launched GitHub Copilot chat so we went from just typing in comments in code to having a chat panel right inside the IDE so now I can do things like hey give me an overview of the entire solution help me write automated tests explain this code to me help me find and fix the bugs in my code and stuff so let's see a little demo of that. 00:08:06.040 |
Copilot is great for giving you code suggestions in line as you type but there was no way to easily ask questions or provide additional context until now. 00:08:15.040 |
Copilot chat lets you have a much richer pair programming experience writing Visual Studio and Visual Studio code it can suggest tasks based on your code for example here I have some code I've inherited with a bunch of regular expressions in it but it's pretty poorly documented. 00:08:30.040 |
Let's ask Copilot what they do oh looks like we have validation for email addresses phone numbers and strong passwords make sense but let's ask for help to make this code a bit more readable for the next person. 00:08:43.040 |
I'll type make this code more readable not bad but I'd like some more so let's ask Copilot to separate out the validation functions and add more comments. 00:08:55.040 |
Okay great that's much better the code is now in separate functions with the comments and the variables have much more meaningful names. 00:09:06.040 |
This is going to be a lot easier to maintain going forward so let's bring it over. 00:09:10.040 |
Now let's take a look at some code that isn't working and see if Copilot can help me figure out why. 00:09:16.040 |
I'll ask Copilot to propose a fix for the bugs in my code. 00:09:24.040 |
Now Copilot's determined by looking at my comment and comparing it to the code that I was treating the data as comma separated in my code but in my comment I was saying it was space separated. 00:09:35.040 |
It's also noticed from the comment that I was returning the values in a different order and it's adding some error checking for me that it typically sees with this type of code. 00:09:46.040 |
Okay so let's bring this code over and run it. 00:09:52.040 |
While we're here let's ask Copilot to create some unit tests so we don't accidentally break this code again. 00:09:59.040 |
Copilot's analysing the copaths we take in our code and using the context from the comment to generate a set of unit tests for the branches of logic it sees. 00:10:08.040 |
It's a great start for us so we could take this copy it over into a test function and then build that out over time. 00:10:17.040 |
With chat functionality right in your editor it's so much easier to stay focused and on task. 00:10:23.040 |
You can ask for help about coding right where you are. 00:10:26.040 |
You can even have a conversation with Copilot to learn more. 00:10:32.040 |
However we're deliberately constraining the prompt to ensure we only have questions that we detect has an intent around programming. 00:10:39.040 |
If we stray outside of this it will politely decline. 00:10:46.040 |
You're on your own as far as figuring out what's for dinner. 00:10:50.040 |
So yeah you can see there he was able to have the code explained to him, generate comments for the code, refactor it, debug code, write unit tests for it, all from working right inside of GitHub Copilot chat. 00:11:11.040 |
Now we made a pretty big splash at Microsoft build last month talking about GitHub Copilot extensions. 00:11:21.040 |
So this brings the world's knowledge into the most widely adopted AI developer tool. 00:11:29.040 |
And through a growing partner ecosystem Copilot extensions are going to enable developers to build and deploy to the cloud with natural language with their preferred tools and services. 00:11:41.040 |
You know a lot of third parties out there, MongoDB and Octopus Deploy and Data Stacks and lots of others understand that GitHub is the place that developers want to be. 00:11:56.040 |
So that developers can stay in the flow now with GitHub extensions you can access information and things from a lot of these other third party systems directly from GitHub Copilot chat. 00:12:10.040 |
And so you can see we had an initial set of partners here and actually I'm going to play through one of the little demos here. 00:12:23.040 |
So that link there and again this will all be provided at the end takes you to this blog post where we made the announcement and I'm going to play the Octopus Deploy demo. 00:12:39.040 |
The Octopus extension for GitHub Copilot allows developers to maintain a state of flow by querying the state of their deployments from the same tools they use to write their code. 00:12:52.040 |
In this example, we have a Node.js web application. 00:12:55.040 |
We will commit and push changes to our Git repository and track those changes through the GitHub Copilot chat interface. 00:13:01.040 |
We'll make a small change to the index page, save those changes and then push those to our repository. 00:13:08.040 |
Once pushed, the GitHub actions workflow will trigger a build and initiate a deployment to Octopus Deploy. 00:13:14.040 |
We can then track the deployment through the Octopus extension for GitHub Copilot. 00:13:19.040 |
We can view the high-level status of deployments to all environments with a text-based dashboard. 00:13:24.040 |
So you can see he asked there, hey Octopus Deploy, show me the dashboard. 00:13:31.040 |
And again, without breaking the flow right inside of GitHub Copilot chat, he's getting this information to see, okay, have the changes been deployed all the way to production yet? 00:13:41.040 |
Let's look at the versions and see, no, the latest version is not yet in production. 00:13:47.040 |
So getting all this valuable information without leaving your flow. 00:13:53.040 |
Useful items in the deployment logs like URLs can be extracted. 00:13:59.040 |
Actually, in the interest of time, we'll just stop there because there's definitely other things that I want to cover. 00:14:06.040 |
But yeah, you can see that full demo if you go to GitHub.blog and look for the Copilot extensions blog post. 00:14:14.040 |
And we'll have links to that available later. 00:14:18.040 |
So in February, we launched GitHub Copilot Enterprise. 00:14:24.040 |
So now, not only are you able to do all of this inside of your IDE, but bringing it to GitHub Enterprise Cloud 00:14:34.040 |
and adding new capabilities like building Bing search right into the chat and everything. 00:14:43.040 |
Being able to tap into knowledge bases of information that you have and everything. 00:14:52.040 |
So for this, I'm actually going to do a live demo if I can find. 00:15:16.040 |
So I'm on github.com/github, you know, where we have our repositories and everything. 00:15:22.040 |
And you can see here now, we actually have the chat available to us right inside of github.com. 00:15:31.040 |
So I can come in here and I can ask general questions. 00:15:36.040 |
Like let's say I'm starting a new project and I know we want to put feature flags into our solution. 00:15:43.040 |
So I could say, how do I, whoops, if I type my little shortcut right here. 00:15:52.040 |
How do I get started with feature flags here at GitHub? 00:15:54.040 |
Now if I don't specify that I want to search our knowledge bases, I'm going to get a very generic answer. 00:16:07.040 |
But now we have the capability to add in your own knowledge bases. 00:16:13.040 |
So knowledge bases are collections of markdown files that are stored right inside of your repos themselves. 00:16:23.040 |
So if I say, hey, I, I want as context to look at the GitHub engineering documentation. 00:16:30.040 |
And then I ask that same, ask that same, well, yeah, I should have pulled out my other keyboard. 00:16:54.040 |
How do I get started using feature flags here at GitHub? 00:16:57.040 |
Now I'm going to see a different answer with more specifics based on GitHub engineering's documentation and everything. 00:17:08.040 |
So, and actually this is still somewhat generic. 00:17:12.040 |
It's, it's, it, but it is referencing documentation from our, from our knowledge base. 00:17:20.040 |
So I'm going to do this again because I typically get a little different answer there. 00:17:43.040 |
You know, it's saying, hey, we use the flipper framework here internally. 00:17:49.040 |
So it's showing me specifics about here's what I need to actually put in my code to get started with feature flags. 00:18:00.040 |
Now I'm going to flip over to another environment. 00:18:04.040 |
This environment uses enterprise managed users. 00:18:07.040 |
So let me do a refresh here because I'll have to re-log in. 00:18:16.040 |
So, yeah, I have a separate identity under enterprise managed users because now this is for everything internal. 00:18:23.040 |
You know, this is a walled garden to ensure that I, nobody can accidentally take a private repository and make it public and things like that. 00:18:33.040 |
So a lot of the security that enterprises are looking for. 00:18:36.040 |
But in this case, I have, this is, this is a parts unlimited website. 00:18:45.040 |
So if I open up, you know, if I open up the website, it's a site for selling auto parts, right? 00:18:56.040 |
Anybody ever read the Phoenix project by Jean Kim? 00:19:03.040 |
Parts unlimited was the fictitional company that was in that book. 00:19:08.040 |
So parts unlimited started out as a brick and mortar store in the Washington area. 00:19:16.040 |
So right now sales tax is kind of hard coded to sales tax for Washington. 00:19:26.040 |
Now that we're an e-commerce site, we have to be able to calculate sales tax wherever the buyer lives, right? 00:19:33.040 |
So I'm going to bring up GitHub co-pilot chat here, enterprise chat, and ask where, come on, my keys will cooperate. 00:19:45.040 |
Where in this repo do we have code that calculates sales tax? 00:19:56.040 |
So something you, something to notice here is it's saying this repository has been indexed for improved understanding and accuracy. 00:20:07.040 |
So with GitHub co-pilot enterprise, you go through and pick what repos you want to index for these types of searches. 00:20:14.040 |
So it's telling me, yes, there's the default shipping tax calculator CS file that includes this calculate tax function. 00:20:29.040 |
But then it's also showing me who the other callers are of calculate tax. 00:20:33.040 |
So I get a good picture, you know, of how this is working throughout the entire solution or repository. 00:20:48.040 |
So we can open that file up and we'll see, okay, here's calculate tax. 00:20:54.040 |
And yeah, in fact, it is hard coded right now to certain tax rates. 00:21:10.040 |
This is where kind of like the, the Bing, built in Bing search comes into play. 00:21:16.040 |
Are there any public APIs out there that I can use to calculate sales tax in any postal code? 00:21:23.040 |
So now it's going to come back with a list of APIs that I could use here. 00:21:31.040 |
Free sales tax API, tax APIs, sales tax USA, Avalara, et cetera. 00:21:42.040 |
So now I want to leverage GitHub co-pilot enterprise to say, hey, 00:21:47.040 |
what would that calculate tax function look like if I wanted to use, let's say, the Avalara API? 00:21:56.040 |
So the, but what I want to do is first kind of set the context for co-pilot. 00:22:10.040 |
Calcule, and see if my keyboard will cooperate. 00:22:28.040 |
So now I'm telling co-pilot that's the context that I'm talking about. 00:22:34.040 |
So now I will say, how would this, how would I update this code to use Avalara API? 00:22:54.040 |
All right, and you can see this, this is live demo responding in real time. 00:23:10.040 |
So now if we look here at the differences, kind of try to zoom in here. 00:23:18.040 |
Yeah, you can see where we were calculating, you know, the tax rate here hard coded. 00:23:24.040 |
Now it is showing me how to, it's doing the same thing. 00:23:31.040 |
It's still returning taxable times tax rate and all that. 00:23:34.040 |
But here it is using that Avalara API and everything instead. 00:23:42.040 |
Now another key thing here, if I scroll down and look at some of the additional explanation it gave me. 00:23:49.040 |
It said, hey, there's one possible vulnerability here. 00:23:53.040 |
You're, when you're working with an API like that, you're going to have an API key that you have to store. 00:24:00.040 |
So it's telling me, make sure you do not hard code that API key in your code. 00:24:06.040 |
Make sure you store that in HashiCorp Vault or Azure Key Vault or GitHub Secrets or something like that. 00:24:14.040 |
So it's helping you with some of those security best practices as well along the way. 00:24:24.040 |
A couple more things and then kind of, about five, six minutes left. 00:24:33.040 |
There's demos out there on YouTube for GitHub Copilot Enterprise and everything also. 00:24:42.040 |
One other thing I want to show you is we, we have it now so that when we're looking at pull requests. 00:24:54.040 |
And I was kind of lazy when I first created this pull request. 00:24:58.040 |
I've got GitHub integrated with Azure Boards. 00:25:01.040 |
So I referred to the Azure Boards, user stories and work tasks and stuff that I'm completing as part of this. 00:25:09.040 |
But I didn't provide any other kind of a description. 00:25:12.040 |
Well now, with GitHub Copilot chat, I can edit this and you'll see we have the Copilot icon in here as well. 00:25:23.040 |
So I could come in here and say, hey Copilot, generate a summary for me. 00:25:30.040 |
So, how many times do developers write nice summaries that anybody could read? 00:25:38.040 |
You know, getting ready to review the code and everything. 00:25:43.040 |
But with Copilot, it's going to look at all the changes that you've made, provide a nice summary paragraph, 00:25:51.040 |
and then file by file list out all of the changes. 00:26:01.040 |
And then you can see, yeah, file by file, it's listing out each change in each file kind of a thing. 00:26:09.040 |
So, and it makes it easy for developers then to provide a lot of information and, you know, not have to spend a lot of time doing that. 00:26:19.040 |
Now the other thing that you can do here when you're looking at a pull request, and we even have more coming with this. 00:26:32.040 |
So I can go in and look at one of my changes. 00:26:38.040 |
I'm going to skip over this one for the moment. 00:26:51.040 |
We're just doing some rebranding of the website here. 00:26:54.040 |
But if this were more complex, you know, I could say explain and have Copilot explain the change to me. 00:27:03.040 |
So, yeah, in this case, it's just that simple changing from Fabricam to Contoso. 00:27:08.040 |
But if this were more complex, you know, the reviewer can look at this, look back at that user story and say, okay, by looking at the user story, I know what the intent was. 00:27:18.040 |
Now, does Copilot agree that what's actually implemented matches that intent? 00:27:25.040 |
So that's another way to use Copilot Enterprise. 00:27:32.040 |
We talked about searching the knowledge bases, pull request summaries and such. 00:27:40.040 |
This works with -- Copilot works with any language. 00:27:44.040 |
The large language models have been built off of the vast majority of the open source code that's out there. 00:27:53.040 |
So I found a COBOL repository out there that has COBOL examples in it. 00:28:06.040 |
And GitHub Copilot was able to provide an explanation for me, you know, simple Fibonacci sequence. 00:28:14.040 |
So you could then next prompt and say, hey, how would -- what would that code look like in Java? 00:28:20.040 |
What would that code look like in C# or something? 00:28:24.040 |
So use this as a way to modernize your COBOL and other code. 00:28:44.040 |
I'm not sure if there's anybody coming in the room right away here at 11:15. 00:28:49.040 |
Let me do this first just in case there is somebody coming in next. 00:28:53.040 |
So if you want to take a screenshot of this URL, we have a page out there that has, I don't know, 15, 20 links to additional training, some of our key blog posts, and things like that that we've recently had. 00:29:16.040 |
As more and more things come in, we'll add to that and everything. 00:29:22.040 |
Also, yes, we'll be at the GitHub booth where we can answer additional questions and things like that. 00:29:36.040 |
So, yeah, stop by the Microsoft booth and we'll show you Copilot workspace.