Recently I was granted access to GitHub's new Ai pair programming tool called CoPilot. This experimental VSCode extension leverages OpenAi's new Codex Ai Model to generate code in popular programming languages such as Typescript and Python.
Within a few hours I was able to get it to write a rather decent application using GPT3 to tell jokes. It's an impressive feat of engineering already and I expect the consumer ready version will revolutionize the development industry more so than intellisense and the VSCode IDE. It feels like something special and I am excited to be among one of the first to use it!
Find the GitHub Repo Here
What is Github CoPilot?
GitHub Copilot is an AI pair programmer that helps you write code faster and with less work. It draws context from comments and code, and suggests individual lines and whole functions almost instantly.
It is one more step towards OpenAi's goal of AGI or Artificial General Intelligence. I believe this is a significant step towards Ai that can write it's own code.... setting the stage for general intelligence in man made networks.
What is GPT-3 Codex by OpenAi?
GitHub Copilot is powered by OpenAI Codex, a new Ai system created by OpenAi. It is an Ai system that translates natural language to code and is available in private beta by API.
OpenAI Codex is a descendant of GPT-3 ( the general purpose natural language Ai ); it's training data contains both natural language and billions of lines of source code from publicly available sources, including code in public GitHub repositories. OpenAI Codex is most capable in Python, but it is also proficient in over a dozen languages and growing.
What Does CoPilot Do?
Once a programmer knows what to build, the act of writing code can be thought of as (1) breaking a problem down into simpler problems, and (2) mapping those simple problems to existing code (libraries, APIs, or functions) that already exist. The latter activity is probably the least fun part of programming (and the highest barrier to entry), and it’s where OpenAI Codex excels most.
With knowledge of public documentation, standards, and open source code, CoPilot showed me it was effective at following broad commands to create a working app in several different environments.
Let's take a look at an GPT3 Joke app I built with CoPilot in a matter of an hour or two. You can find the Github repository here
Written by CoPilot .... mostly.
I decided to use the GPT-3 API to find and write jokes for a simple app. The app should be able to generate a joke when a button is clicked, but not allow the user to click the button while the joke is being generated (avoid the costly GPT3 API !) , be able to share the latest joke on Twitter, display the jokes in a list optimized for mobile, and have a button to clear the jokes from the list. I did not want to save them anywhere mainly to show that GPT3 is returning the joke not a database!
Once I knew generally what I wanted to build I setup a new npm project and added my typescript dependencies and setup an index.ts and index.html. I was very interested how well CoPilot would handle Typescript considering it should be easier for CoPilot to infer code with strong typing.
I used comments to instruct CoPilot and provided as little instruction as possible to see the results.
With a simple prompt of <!--- setup an HTML page --> it added the head and necessary bootstrap libraries. I had yet to setup a css folder so I did that after it added it to the head of the HTML page.
I then continued down the page using comments to specify the elements I wanted. It worked very well in setting up bootstrap elements and their attributes.
For the app's typescript I used index.ts to start development by first writing the interface for the App class then continuing down the file with the comments as shown in the GitHub repo. The only thing I attempted several times was to get a working share button, eventually I found by writing the function name of shareToTwitter that it was able to write an effective function without additional instruction.
And the Results Are....
I was very impressed on how quickly CoPilot was able to come up with solutions and when I began using it in my real work this week it felt like I was part of something special. Technology is moving exceptionally fast but CoPilot (and the GPT API overall) are going to change the world.
As a programmer who spends >90% coding alone, it is very challenging to keep up with new standards, frameworks and design paradigms. CoPilot offers a way for seasoned programmers to maintain the pace they are used to, even in unknown environments, while learning its conventions. While for new developers it is a powerful tool to speed up learning some of the simpler concepts while increasing efficiency.
As an individual developer it is already becoming the most powerful tool in my Ai tool kit. Getting stuck on , sometimes rudimentary, problems while coding independently can be costly and frustrating. Copilot let's me find acceptable solutions quickly especially when I am bouncing between multiple languages. This allows me to focus on solving complex business problems and less time on the actual implementation.
I can already imagine a world where Ai can more effectively write code than any human creating a huge shift in how we interact with systems of all kinds. While I am no longer a young guy, I expect the contributions that Ai will make in my lifetime to change the landscape of how we live, work and play. Github's CoPilot and GPT-3 are a small peak into the things to come.