← All AI Engineer talks

AI Engineer World's Fair 2024

GitHub Copilot - The World’s Most Widely Adopted AI Developer Tool

About this talk

GitHub developer advocate Dave Burnison demonstrates how GitHub Copilot expanded from IDE code completion into conversational assistance, enterprise knowledge retrieval, and GitHub.com pull-request workflows. Examples cover supported editors and repository hosts, context-aware Django/Python code generation, Copilot Chat, GitHub Actions and Octopus Deploy integration, and enterprise-managed user isolation.

Chapters

  1. 0:00Introduction and the evolution of GitHub Copilot
  2. 2:13Supported IDEs, repositories, and Django code-generation demo
  3. 8:05Copilot Chat demonstration
  4. 12:42Octopus Deploy extension and GitHub Actions workflow
  5. 15:11GitHub.com enterprise chat and managed-user isolation
  6. 28:43Closing questions, GitHub booth, and Copilot Workspace

Talk transcript

  1. 0:00

    [upbeat music] So good morning, everybody.

  2. 0:15

    Good morning.

  3. 0:16

    There we go. My name's Dave Burnison. I'm a senior DevOps advocate with GitHub, and I wanna talk today about GitHub Copilot and demo a little bit of everything that Copilot is today because it has...

  4. 0:33

    The capabilities have grown a lot now over the last, uh, two, three years. So how many, how many of you are using GitHub Copilot today?

  5. 0:43

    Okay, looks like, uh, half to two thirds kind of a thing, kind of a ratio or so here. So yeah, as we get started, we can see GitHub Copilot started out just as generating code in the IDE with Copilot Individual.

  6. 1:01

    Then we launched Copilot Business into GA. Uh, shortly after that, year and a half ago, I guess that would be, we launched Copilot Chat. So now not only could you ask Copilot to generate code for you, but you could take somebody's existing code.

  7. 1:21

    Maybe they didn't write very good comments in their code. Shocker, right? Say, "Hey, Copilot, explain that code to me," or, "Help me simplify that code." So many more ways to use GitHub Copilot.

  8. 1:33

    And then just this February, we launched GitHub Copilot 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 or tap into information that may be stored in your knowledge bases and ask Copilot questions,

  9. 1:58

    uh, 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, um, we're launching. Uh, right now we've got in beta and, and technical preview and, and such.

  10. 2:13

    So as most of you know, uh, GitHub Copilot is there to be your AI pair programmer, help you, uh, 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, GitHub Codespaces, which is Visual Studio Code running inside the browser, the JetBrains

  11. 2:38

    IDEs like PyCharm and IntelliJ, 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.

  12. 2:59

    It doesn't even have to be Git-based version control, and you can still take advantage of everything that Copilot Business and Copilot Individual have to offer. So I am gonna play through a little, little video of the basics here because there's a couple of things I wanna point out.

  13. 3:15

    This is just a two-minute video.

  14. 3:17

    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-of-business applications, and the first step is to create my model classes, which is typically tedious.

  15. 3:36

    What I'm gonna do instead is describe, using natural language, what I need my model to look like. That gray italicized text is Copilot generating the appropriate code. It creates the class definition and the full class across multiple lines of code.

  16. 3:55

    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.

  17. 4:07

    That entire class, all of those lines of code, was generated for me automatically by Copilot. There was one thing I didn't necessarily want here, which is it's allowing for speakers and talks all to be deleted.

  18. 4:24

    I wanna modify that, so I go back to Copilot, ask it for a new suggestion, and it generates one. Finally, I wanna add on a code for the talk which matches a particular pattern.

  19. 4:38

    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.

  20. 4:55

    This allows me to stay in the zone and focus in on the more important aspects of writing code.

  21. 5:04

    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.

  22. 5:14

    It's called GitHub Copilot. It's not called GitHub Autopilot. You know, this is not gonna replace developers. We still need that person in the middle, and there was a great example here of that.

  23. 5:27

    You know, when it generated, uh, the, the, in the talk class, initially it was allowing speakers to be deleted even when talks existed. So he wiped out that line.

  24. 5:40

    Con- 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.

  25. 5:56

    Now, another thing, there's, there's actually an opportunity here in this, in the, even in this little demo to talk about prompt crafting or prompt engineering You know, when, when he was adding this talk code, he didn't just say, "Add a talk code."

  26. 6:13

    He was more specific, right? He said, "With a format of three letters, a dash, and three numbers." And that w- allowed him to get back the regular expression that he needed.

  27. 6:26

    So the, 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.

  28. 6:38

    He didn't have to leave the IDE and go to find some regular expression documentation or do a, a Google search or anything like that to figure out that syntax.

  29. 6:49

    He got that in a matter of seconds. So you can see, in a second actually, you know, so you can see just how much this can improve productivity and keep you in the flow and things like that.

  30. 7:01

    Now, next we la- ... Oh, so here's some ... At the end, I'll have a link where you can find a lot of these resources, uh, and things. And at some point after this session, I'll put a PDF up there so you've also got all of these, uh, links and things.

  31. 7:19

    But we got several resources now to learn about prompt crafting. 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, w- it'll take less than an hour to understand prompt crafting, but then just kind of playing around with it yourself to get a

  32. 7:35

    better feel, how do you get more accurate suggestions for the context that you're in and everything? 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.

  33. 7:53

    So now I can do things like, "Hey, give me an overview of the entire solution. Uh, help me write automated tests. Explain this code to me. Help me find and fix the bugs in my code and stuff."

  34. 8:05

    So let's see a little demo of that

  35. 8:06

    Copilot is great for giving you code suggestions inline as you type, but there was no way to easily ask questions or provide additional context until now. Copilot Chat lets you have a much richer pair programming experience right in Visual Studio and Visual Studio Code.

  36. 8:22

    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.

  37. 8:31

    Let's ask Copilot what they do. Oh, looks like we have validation for email addresses, phone numbers, and strong passwords. Makes sense. But let's ask for help to make this code a bit more readable for the next person.

  38. 8:44

    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.

  39. 8:58

    Okay, great. That's much better. The code is now in separate functions with the comments, and the variables have much more meaningful names. This is gonna be a lot easier to maintain going forward, so let's bring it over.

  40. 9:12

    Now let's take a look at some code that isn't working and see if Copilot can help me figure out why. I'll ask Copilot to propose a fix for the bugs in my code.

  41. 9:24

    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.

  42. 9:36

    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.

  43. 9:47

    Okay, so let's bring this code over and run it. And yep, that works. Brilliant. While we're here, let's ask Copilot to create us some unit tests so we don't accidentally break this code again.

  44. 9:59

    Perfect. Copilot's analyzing the code paths 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.

  45. 10:09

    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. But let me show you one last thing.

  46. 10:17

    With chat functionality right in your editor, it's so much easier to stay focused and on task. You can ask for help about coding right where you are. You can even have a conversation with Copilot to learn more.

  47. 10:30

    Let's ask for an example here. However, we're deliberately constraining the prompt to ensure we only have questions that we detect has an intent around programming. If we stray outside of this, it'll politely decline.

  48. 10:44

    So yeah. While Copilot can help, you're, you're on your own as far as figuring out what's for dinner. So,

  49. 10:52

    so yeah, you can see there he was able to have the code explained to him, generate comments for the code, refactor it, uh, debug code, write unit tests for it, all from working right inside of GitHub Copilot Chat.

  50. 11:08

    So we added a lot more capabilities there. Now, we made a pretty big splash at Microsoft Build last month talking about GitHub Copilot Extensions. So this brings the world's knowledge into the most widely adopted AI developer tool.

  51. 11:29

    And through a growing partner ecosystem, Copilot Extensions are gonna enable developers to build and deploy to the cloud where the, with natural language with their preferred tools and services.

  52. 11:41

    You know, a lot of third parties out there, MongoDB and, and, um, Octopus Deploy, and DataStax and, and, and lots of others understand that GitHub is the place that developers wanna be.

  53. 11:56

    So the developers can stay in the flow now with GitHub Extensions. You can access information and things, uh, from a lot of these other third-party systems directly from GitHub Copilot Chat.

  54. 12:13

    And so you can see we had a, an initial set of partners here, and actually I'm gonna play through one of the little demos here that, so that, that link there, and again, all, this'll all be provided, uh, at the end, uh, takes you to this blog post where we made the announcement, and I'm gonna play the,

  55. 12:35

    uh, Octopus Deploy demo. [upbeat music]

  56. 12:42

    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.

  57. 12:52

    In this example, we have a Node.js web application. We will commit and push changes to our Git repository and track those changes through the GitHub Copilot Chat interface. We'll make a small change to the index page, save those changes, and then push those to our repository.

  58. 13:08

    Once pushed, the GitHub actions workflow will trigger a build and initiate a deployment to Octopus Deploy. We can then track the deployment through the Octopus extension for GitHub Copilot.

  59. 13:19

    We can view the high-level status of deployments to all environments with a text-based dashboard.

  60. 13:25

    So you can see he asked there, "Hey Octopus Deploy, show me the dashboard." 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?

  61. 13:41

    Let's look at the versions and see. No, the latest version is not yet in production. So getting all of this valuable information without leaving, uh, your flow.

  62. 13:53

    Useful items in the deployment logs, like URLs, can be extracted. We can use the comprehension ca-

  63. 13:59

    Actually, in the interest of time, we'll ju- we'll just stop there 'cause there's definitely other things that I want to, uh, cover. But yeah, you c- you can see that full demo if you go to github.blog and look for the Copilot Extensions blog post, and we'll have links to that, uh, available, uh, later.

  64. 14:18

    So in February, we launched GitHub Copilot Enterprise. So now, not only are you able to do all of this inside of your IDE, but bringing it to GitHub Enterprise Cloud and adding new capabilities, like building a Bing search right into, uh, the chat and everything, be-

  65. 14:43

    being able to tap into knowledge bases of information that you have, uh, and everything. So for this, I'm actually gonna do a live demo, if I can find... Here we go.

  66. 14:59

    So here I am on GitHub. Uh, let me reload this.

  67. 15:11

    Get logged in here. There we go. So I'm on [REDACTED:url], you know, where, where we have our repositories and everything, and you can see here now, we actually have, uh, the chat available to us right inside of github.com.

  68. 15:31

    So I can come in here, and I can ask general questions. Like let's say I'm starting a new project and I know we wanna put feature flags into our solution.

  69. 15:43

    So I could say, "How do I..." Whoops. If I type my little shortcut right here, "How do I get started with feature flags here at GitHub?" Now, if I don't specify that I wanna search our knowledge bases, I'm gonna get a very generic answer.

  70. 16:01

    Choose a feature flag library, integrate that library, uh, and, and, and such. But now we have the capability to add in your own knowledge bases. So knowledge bases are collections of markdown files that are stored right inside of your repos themselves.

  71. 16:23

    So if I say, "Hey, I, I want as context to look at the GitHub engineering documentation," and then I ask that same,

  72. 16:35

    ask that same... Well, yeah, I should br- pulled out my other keyboard. This keyboard's a little sticky. Come on now.

  73. 16:53

    There we go. "How do I get started using feature flags here at GitHub?" Now I'm gonna see a different answer with more specifics based on GitHub Engineering's, uh, documentation and everything.

  74. 17:08

    So, and actually, this is still somewhat generic. It's, it's, it, but it is referencing documentation from our, uh, from our knowledge base. So I'm gonna do this again, 'cause I typically get a little different answer there.

  75. 17:31

    There we go. Now my shortcut's working. There we go. This is more what I was hoping to see. So now it's giving me specifics. You know, it's saying, "Hey, we use the Flipper fr- Framework here internally."

  76. 17:49

    So it's showing me specifics about here's what I need to actually put in my code to get started with feature flags.

  77. 17:57

    So that's using knowledge bases. All right, now I'm gonna flip over to another environment. This environment uses enterprise-managed users, so let me do a refresh here, 'cause I'll have to re-log in.

  78. 18:12

    There we go So yeah, I have a separate identity under enterprise-managed users, 'cause now this is for everything internal. You know, this is a walled garden to ensure that I, nobody can accidentally take a private repository and make it public, uh, and things like that.

  79. 18:33

    So a lot of the security that enterprises are looking for. But in this case I have... This is, this is, uh, Parts Unlimited, uh, website. So if I open up,

  80. 18:48

    and if I open up the website, it's a site for selling auto parts, right? And how many recognize Parts Unlimited?

  81. 18:58

    Anybody ever read The Phoenix Project by Gene Kim? Okay. Yeah. Parts Unlimited was the fictitional company that was in that book. But anyway, um, yeah. So Parts Unlimited started out as a brick and mortar store in the Washington area.

  82. 19:17

    So right now sales tax is kinda hard-coded to sales tax for Washington, but that, that's not what we want. Now that we're an e-commerce site, we have to be able to calculate sales tax wherever the buyer lives, right?

  83. 19:33

    So I'm gonna bring up GitHub Copilot Chat here, Enterprise Chat, and ask where...

  84. 19:43

    Come on, if my keys will cooperate. Where in this repo do we have code that calculates sales tax?

  85. 19:54

    So it'll take a moment, but it's looking... So something you,

  86. 19:59

    something to notice here is it's saying, "This repository has been indexed for improved understanding and accuracy." So with GitHub Copilot Enterprise, you go through and pick what repos you want to index for these types of searches.

  87. 20:14

    So it's telling me, yes, there's the default shipping tax calculator CS file that includes this calculate tax function. And I'm actually going... Oh, come on.

  88. 20:29

    Well, there we go. I'm gonna copy calculate tax there. But then it's also showing me who the other callers are of calculate tax. So I, I get a good picture, you know, of how this is, uh, working throughout the entire solution, uh, or repository.

  89. 20:48

    So we can open that file up and we'll see, okay, here's calculate tax and yeah, in fact it is hard-coded right now to certain tax rates. So 7.5% sales tax for state of Washington.

  90. 21:05

    That might even be out of date. Um, but now I'm gonna ask Copilot, this is where kinda like the, the Bing, built-in Bing search comes into play. Are there any public APIs out there that I can use to calculate sales tax in any postal code?

  91. 21:23

    So now it's gonna come back with, uh, a, a list of APIs that I could use here.

  92. 21:32

    Free sales tax API, tax APIs, uh, Sales Tax USA,

  93. 21:39

    Avalara, et cetera. So now I wanna leverage GitHub Copilot Enterprise to say, "Hey, what would that calculate tax function look like if I wanted to use, let's say, the Aval- Avalara, uh, API?"

  94. 21:57

    So the... But what I wanna do is first kinda set the context for Copilot. So I'm gonna say...

  95. 22:05

    Now did that paste? Nope, doesn't look like it. Uh, see if I can spell it right. Calcu...

  96. 22:13

    And see if my keyboard will cooperate. There we go. Calculate tax.

  97. 22:28

    So now I'm telling Copilot that's the context that I'm talking about. So now I will say,

  98. 22:39

    "How would this, how would I update this code to use

  99. 22:47

    Avalara API?" All right, and you can see this, this is live demo responding in real time.

  100. 23:10

    So now if we look here at the, the differences, I'll kinda z- try to zoom in here. Yeah, you can see where we were calculating, you know, the tax rate here hard-coded.

  101. 23:24

    Now it is showing me how to... It's doing the same thing. It's still returning taxable times tax rate and all that, but here it is using that Avalara API and everything instead.

  102. 23:43

    Now another key thing here, if I scroll down and look at some of the additional explanation it gave me, said, "Hey, there's one possible vulnerability here. You're, y- when you're working with an API like that, you're gonna have an API key that you have to store."

  103. 24:01

    So it's telling me, "Make sure you do not hard-code that API key in your code. Make sure you store that in HashiCorp Vault or Azure Key Vault or GitHub Secrets or, or something like that."

  104. 24:15

    So it's helping you with some of those security best practices, uh, as well along the way.

  105. 24:25

    Couple more things and then kinda, uh, about five, six minutes left. So yeah, there's demos out there on YouTube for GitHub Copilot Enterprise and everything also. Oh, yeah, so that was the chat in the repository.

  106. 24:41

    One other thing I wanna show you is

  107. 24:46

    we, we have it now so that when we're looking at pull requests. So here's, here's an existing pull request. And I was kinda lazy when I first created this pull request.

  108. 24:58

    I've got GitHub integrated with Azure Boards, so I referred to the Azure Boards user stories and, uh, work i- uh, tasks and stuff that I'm completing as part of this, but I didn't provide any other kind of a description.

  109. 25:12

    Well, now with GitHub Copilot Chat, well, I can edit this, and you'll see we have the Copilot icon in here as well. So I could come in here and say, "Hey, Copilot,

  110. 25:28

    generate a summary for me." So c- how many times do developers write nice summaries that anybody could read? You know, getting ready to c- review the code, uh, and everything.

  111. 25:41

    Yeah, [chuckles] not very, not very often. But with Copilot, it's gonna look at all the changes that you've made, provide a nice summary paragraph, and then file by file, list out all of the changes.

  112. 25:54

    There we go. Just took a few seconds.

  113. 25:58

    So now I have a nice summary here, and then you can see, yeah, file by file, it's listing out each change in each file kind of a thing. So, and it makes it easy for developers then to provide a lot of information and, uh, you know, not have to spend a lot of time doing that.

  114. 26:19

    Now, the other thing that you can do here when you're looking at a pull request, and we, we, we even have more coming with this.

  115. 26:28

    Okay. Come on, internet, you can do it. There we go.

  116. 26:33

    So I can go in and look at one of my changes. I'm gonna skip over this one for the moment. Yeah, let me just look at this change, and I can come in...

  117. 26:44

    Whoops, that's not the- what I want. Here we go. You'll see the Copilot icon here too. Now, this is obviously a very simple change. We're just doing some rebranding of the website here.

  118. 26:54

    But if this were more complex, you know, I could say Explain and have, uh, Copilot explain the change to me. So yeah, th- in this case, it's just that simple changing from Fabrikam to Contoso.

  119. 27:08

    But if this were more complex, you know, the, 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.

  120. 27:19

    Now, does Copilot agree that the, what's actually implemented matches that intent?"

  121. 27:25

    So that's another way to use Copilot Enterprise.

  122. 27:30

    So we talked about the chat. We talked about searching the knowledge bases,

  123. 27:37

    pull request summaries, and such. This, this works with... Copilot works with any language. The large language models have been built off of the vast majority of the open source code that's out there.

  124. 27:50

    There's even COBOL code out there. So I found a COBOL, uh, a repository out there that has COBOL examples in it. So I said, "Hey, what, what does this code do?"

  125. 28:07

    And GitHub Copilot was able to provide an explanation for me. You know, simple Fibonacci sequence. So you could then next prompt and say, "Hey, how would, what would that code look like in Java?

  126. 28:21

    What would that code look like in C#?" Or something. So use this as a way to modernize your, your, uh, COBOL and other code. The next one is Copilot Workspace.

  127. 28:34

    Ah, I ran out of time. I actually don't... Uh, let's see. Let's go...

  128. 28:43

    All right, let me do this. I'm not sure if there's anybody coming in the room right away here at 11:15. Let me do this first, just in case there is somebody coming in next.

  129. 28:53

    So if you wanna take a screenshot of this, uh,

  130. 28:59

    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.

  131. 29:14

    And yeah, this will be dynamic. As more and more things come in, we'll, um, we'll add to that and everything. Uh, also, yes, we'll be at the GitHub booth, uh, where we can a- answer additional questions and, and things like that.

  132. 29:33

    So yep, I see people moving on. Thank you very much for your time. So yeah, stop by the Microsoft booth and we'll show you Copilot Workspace. [outro music]