OpenAI Codex Live Demo

OpenAI Codex Live Demo

OpenAI Codex Live Demo

The OpenAI team presents the latest version of their model that can write code. They discuss how they got here and the ways to get access to Codex.

Introduction

  • A year ago, OpenAI released GPT-3, a general-purpose language model.
  • Despite not being designed for coding, GPT-3's rudimentary coding capability inspired people.
  • OpenAI decided to create a model specifically for coding and created Codex.

Accessing Codex

  • Codex is now available in the OpenAI API through a beta program.
  • Interested users should sign up on the waitlist.
  • There will be a programming competition where participants will work with Codex as their teammate and competitor on the leaderboard.

Hello World Demo

  • The team demonstrates how easy it is to use Codex by typing "Hello World" into a text box and executing it.
  • The output is displayed below the text box.

Adding Empathy to Hello World

  • The team modifies their instruction to add empathy to "Hello World."
  • The model produces code that outputs "Hello world! I hope you're having a great day."

Generating HTML Code

  • The team demonstrates how Codex can generate HTML code from natural language instructions.
  • They type "Create an HTML page with a heading that says 'Welcome' and an image of a cat" into the text box and execute it.
  • The output displays an HTML page with a heading that says "Welcome" and an image of a cat.

Creating Functions

  • The team shows how easy it is to create functions using Codex.
  • They type "Create a function that takes in two numbers and returns their sum" into the text box and execute it.
  • The output displays the code for a function that takes in two numbers and returns their sum.

Conclusion

The OpenAI team demonstrates how Codex can be used to generate code from natural language instructions. They show how easy it is to use Codex to create functions, HTML pages, and more.

Introduction to the Transcript

In this section, the speaker introduces the topic of the transcript and explains how they will be using a single model proficient in over a dozen programming languages to generate code.

Using a Single Model for Code Generation

  • The speaker explains that they will be using a single model proficient in over a dozen programming languages to generate code.
  • The model works by formatting requests to the Codex API like you would format GPT3 requests.
  • The speaker notes that this allows for seamless translation between different programming languages and makes it easy to interpret what the model is doing.

Generating "Hello World" with Empathy

In this section, the speaker demonstrates how they can use the model to generate code that prints "Hello World" with empathy.

Generating "Hello World" with Empathy

  • The speaker asks if the model can say "Hello World" five times with empathy.
  • They note that while the model did an okay job, it didn't quite meet their expectations.
  • The speaker explains that they can look at the code generated by the model and modify it as needed.
  • They demonstrate how to modify the code using a for loop instead of multiplication.

Creating a Web Page That Says "Hello World"

In this section, the speaker demonstrates how they can use the same model to create a web page that says "Hello World".

Writing Python Code That Emits HTML

  • The speaker writes python code that emits HTML using the same model used earlier.
  • They note that one of the strengths of this approach is its ability to seamlessly switch between different programming languages.

Starting a Python Web Server

  • The speaker starts a python web server on port 8000 and navigates to it in their browser.
  • They note that the web page was generated on the fly and had never been seen before.

Using the Model to Accelerate Programming

In this section, the speaker discusses how using a model like this can accelerate programming by taking care of the boring parts.

The Two Parts of Programming

  • The speaker notes that programming has two parts: understanding the problem and mapping functionality to code.
  • They explain that while understanding the problem is important, it's often more fun to map functionality to code.
  • The speaker notes that this is where models like Codex shine because they have seen so much code and can generate it quickly.

Sending Emails with "Hello World"

  • The speaker suggests sending lots of emails with "Hello World" to everyone listening to their live stream.
  • They note that this would be a good opportunity to demonstrate how easy it is to use Codex for tasks like this.

Introduction to Codex

In this section, the speaker introduces Codex and explains how it works.

How Codex Works

  • Codex is a large neural network trained to do code autocomplete.
  • The neural network reads all the words given to it, digests them inside its neurons, and emits the code that we see.
  • By being good enough at code autocomplete, Codex can perform complex tasks like sending emails using APIs.

Sending Emails with Mailchimp API

In this section, the speaker demonstrates how to use Codex to send emails using Mailchimp API.

Using Mailchimp API with Codex

  • To use Mailchimp API with Codex, we need to provide instructions for humans on the left side of the screen.
  • We can take a look at the actual code that is supposed to be installed on our system. It's just a simple wrapper around the Mailchimp API where we plug in the API key already.
  • We can paste documentation written in readable form into the model. Just three lines of text are enough for the model to understand how to use the API exactly.
  • We ask Codex to look up current bitcoin price and include it in an email blast along with "Hello World" message.
  • After calling Mailchimp API, 1472 emails were sent successfully.

Building a Game

In this section, the speaker shows how to build a game using Codex.

Building a Game with Codex

  • The game involves dodging boulders as they fall from above.
  • A silhouette of a person is used instead of an actual image because they will get squashed by boulders otherwise.
  • Instructions are typed into the text box, and then the model does its neural magic to create the game.
  • The game is built up using multiple lines of code.

Introduction to the Model

In this section, the speaker provides some context about the model used in the project.

Context of the Model

  • The model is based on following instructions in code.
  • Python has one example of following an instruction while JavaScript has two examples.
  • The model latches onto these examples and continues to learn from them.

Controlling the Person

In this section, the speaker discusses how to control the person in the game.

Setting Position and Size

  • Set person's size to 100 pixels.
  • Set position to 500 pixels down and 400 pixels from left.

Making it Controllable with Arrow Keys

  • Make person controllable with left and right arrow keys.
  • Model infers what happens when keys are pressed based on provided context.

Fixing Screen Boundary Issue

  • Constantly check if person is off screen and put it back on screen if so.
  • Disable scroll bars to fix flickering issue.

Adding Upward Movement with Spacebar

  • Make person move upwards when spacebar is pressed.

Adding Downward Movement with Down Arrow Key

  • Make person move downwards when down arrow key is pressed.

Conclusion

In this section, the speaker concludes by discussing how easy it is to export commands from this playground and encourages viewers to modify and fork their own games using Codecs.

Exporting Commands for Modification

  • Text can be thought of as new source code that can be modified or forked easily.
  • Playground makes it easy to export commands for modification.

Creating and Modifying Elements with Codex

In this section, the speaker demonstrates how to use Codex to create and modify elements in a web page.

Creating an Oversized Boulder

  • The speaker creates an oversized boulder element using Codex.
  • The speaker modifies the size of the boulder by setting its width to be four times larger.
  • The speaker explains that Codex allows for easy editing and modification of code directly in the browser.

Making the Boulder Fall and Reappear

  • The speaker explains that coding involves understanding a problem and breaking it down into smaller pieces, which is where Codex excels.
  • The speaker attempts to make the boulder fall from the sky and reappear at the top of the screen when it hits the ground using Codex.
  • When Codex fails, the speaker suggests trying again since there is no punishment for getting it wrong in JavaScript.

Implementing a Loss Condition

  • The speaker notes that a game needs a loss condition and defines what should happen when you lose: clear the screen and show a message saying "you got squashed."
  • The speaker modifies the loss function to include words of encouragement such as "you can do it."

Wiring Up Functions

  • The speaker explains that they need to wire up functions so that they get called at appropriate times.
  • The modified function successfully sets position randomly on top of screen.
  • After modifying instruction, boulder falls from sky.
  • The speaker notes that they need to wire up the loss function so that it gets called when the player loses.
  • The speaker successfully modifies the loss function to include words of encouragement.

Building a Game with Codex

In this section, the speakers build a game using Codex and test it out.

Building the Game

  • The goal is to build a game where the player has to climb up boulders.
  • The game is successfully built in a short amount of time.
  • When the player loses, they receive an encouraging message to try again.

Expanding Possibilities with Codex

In this section, the speakers discuss how Codex can be used to interact with APIs and expand functionality.

Using APIs with Codex

  • It's easy to teach Codex to use any API.
  • Many software programs come with APIs that can be accessed by Codex.
  • With Codex, it becomes possible to talk to your computer and have it carry out commands on your behalf.

Using Microsoft Word API with Codex

In this section, the speakers demonstrate how to use Microsoft Word's API with Codex.

Formatting Text in Microsoft Word

  • Microsoft Word has a JavaScript API that can be accessed by Codex.
  • The speakers take an API reference for Microsoft Word and format it for use with Codex.
  • They demonstrate how speech recognition can be used along with the formatted code to remove initial spaces from text in Microsoft Word.
  • They show how speech recognition can also be used along with the formatted code to make every fifth line bold in Microsoft Word.

Codex vs. GPT-3

In this section, the speakers discuss the differences between Codex and GPT-3.

Talking to vs. Generating Code

  • GPT-3 is a system that you talk to and it talks back to you.
  • With Codex, you talk to it and it generates code, which means it can actually manipulate or act in the computer world on your behalf.
  • This makes Codex more powerful than GPT-3 because it can carry out commands on your behalf.

Introduction

In this section, the speaker introduces the latest generation of the Codex model and highlights that it is only the beginning of an exciting future.

The Latest Generation of Codex Model

  • The new Codex model is better than the previous one.
  • It is just a step towards better neural networks in the future.
  • The speaker emphasizes that this is only the beginning of an exciting future.

Availability and Programming Competition

In this section, the speaker talks about how to access and play with Codex through OpenAI's API. They also mention a programming competition on Thursday at 10 am.

Accessing Codex

  • The latest generation of Codex model is available in OpenAI's API starting today.
  • To play with Codex, sign up for the beta list.

Programming Competition

  • There will be a programming competition on Thursday at 10 am.
  • The competition will involve using Codex in a new kind of programming context.

Conclusion

In this section, the speaker concludes by thanking viewers for tuning in and expressing excitement to see what they will build with Codex.

Thank You and Excitement for Future Projects

  • The speakers thank viewers for tuning in.
  • They express excitement to see what viewers will build with Codex.
Video description

OpenAI Codex is an AI that translates natural language to code. 0:00 - Introduction 2:48 - Hello World 13:08 - Building a game 25:15 - Codex plugin for Microsoft Word Learn more: https://openai.com/blog/openai-codex