OpenAI have unleashed their latest and most impressive upgrade to the ChatGPT experience. It is a standalone model called Code Interpreter. Now, if you’re thinking that this sounds familiar - everyone’s tried coding with chatbots by now, and it’s frustrating! - think again, because Code Interpreter doesn’t assist you in writing code; it uses code on its own to perform the tasks you assign to it. You don’t need to do any coding, or even know anything about coding, to use it!
INTERPRETING CODE INTERPRETER
Obviously, everything ChatGPT does is powered by “code” at the most basic level, and the same is true of Bard, Claude and the rest of the LLM chatbot gang. Where Code Interpreter (CI, for short) differs is that it provides what coders call an “environment” - effectively a digital sandbox - where it uses one of the most popular programming languages, Python, to carry out a variety of tasks. One of the cool things about Python is how versatile it is, thanks to “libraries” - plug-ins that extend Python’s basic capabilities to enable specific tasks, and CI’s environment comes pre-loaded with a wide variety of these libraries.
This story is part of our weekly briefing. Sign up to receive the FREE briefing to your inbox.
OpenAI have unleashed their latest and most impressive upgrade to the ChatGPT experience. It is a standalone model called Code Interpreter. Now, if you’re thinking that this sounds familiar - everyone’s tried coding with chatbots by now, and it’s frustrating! - think again, because Code Interpreter doesn’t assist you in writing code; it uses code on its own to perform the tasks you assign to it. You don’t need to do any coding, or even know anything about coding, to use it!
INTERPRETING CODE INTERPRETER
Obviously, everything ChatGPT does is powered by “code” at the most basic level, and the same is true of Bard, Claude and the rest of the LLM chatbot gang. Where Code Interpreter (CI, for short) differs is that it provides what coders call an “environment” - effectively a digital sandbox - where it uses one of the most popular programming languages, Python, to carry out a variety of tasks. One of the cool things about Python is how versatile it is, thanks to “libraries” - plug-ins that extend Python’s basic capabilities to enable specific tasks, and CI’s environment comes pre-loaded with a wide variety of these libraries.
The most obvious - but far from the most interesting - example of why this is a big deal is math. ChatGPT is a language model, and if you prompt it with “2+2=?”, it doesn’t see a math puzzle but an odd looking sentence, and it doesn’t work out the answer with addition, but with probability. As such, there’s a chance it will get the answer wrong. Python, on the other hand, is not a language model but a programming language, and they’re extremely good at math, and also, as we’re about to see, things like data analysis, game design, image manipulation, and even working out the secret of happiness!
GETTING STARTED
Before we get to that, some practicalities. Like most of ChatGPT’s best stuff, CI is only available to ChatGPT Plus subscribers and power users who are plugged into OpenAI’s API. The latter is far beyond the scope of this article, and we’ll be focussing on the ChatGPT Plus website.
To access the CI model, you’ll need to select GPT-4 from the options at the top of the input window, and then Code Interpreter from the drop down. This will place you in a window that looks like every other ChatGPT window, but there is a crucial difference: a small plus sign in the left hand side of the input field. This is the upload button, and can be used to upload a wide variety of file types, including text files, spreadsheets, audio, images and even video files. There’s a generous 100mb cap on upload sizes, and one other useful tidbit is that CI will accept compressed files, so as long as you can get your zipped data below 100mb, you’re good to go. But where?
THE SECRET OF HAPPINESS
We found this example of CI’s power on the official OpenAI Discord’s “code-interpreter-outputs” channel, which is a great place to look for prompt inspiration. Discord user JP- uploaded the 2019 World Happiness Report data to CI, and asked it to analyze the numbers to find “the secret of happiness”. They have subsequently shared the discussion here, and it’s well worth clicking through to see the ease with which CI understands and fulfills the brief. It’s not only able to quickly identify the factors that correlate with national happiness (high GDP per capita, strong social support, long healthy life expectancies, relatively high levels of freedom to make life choices, and relatively low perceptions of corruption), but also creates a training model to enable predictions of happiness levels based on incomplete data.
This new ability to quickly perform accurate data analysis is an enormous leap forward for chatbots, and as far as practical applications of LLM technology go, it’s a game changer. Thanks to the variety of Python libraries at CI’s disposal, you can also visualize data in many ways, including the creation of downloadable interactive maps and graphs.
A note on datasets; if you don’t have your own data that needs analysis, you can find datasets for almost any subject online. A great place to look for them is a website called Kaggle, which hosts over a quarter of a million of the things, although if you want a specific one to start with we’d recommend the CIA World Factbook, which is stuffed with information that CI will love to crunch. Sadly, you will find with most public datasets (including the Factbook) that the data is messy, and CI may struggle to work with it at first, but the good news here is that CI also specializes in data cleaning tasks, and is smart enough to recognize when they’re needed. If there’s a problem with your data, the most likely outcome is that CI will ask you for permission to fix it! That said, although Python’s influence really helps to minimize the frequency of hallucinations, they do still happen, and you should still carefully double check ChatGPT’s outputs for errors. Also, if you’re data is in any way sensitive or private, it’s best to avoid using ChatGPT for these tasks, either on web or through an app; the API is the safest way to handle that sort of information.
WHAT ELSE CAN IT DO?
It’s early days yet for CI, and there’s little doubt that we’re not even close to seeing its full potential yet, but we have seen some amazing and amusing use cases so far. Discord users have persuaded the model to program board games and convert Microsoft Excel to Mario Paint, and these are excellent examples of using Python’s raw programming abilities to make amazing (or ridiculous) things happen, but what of those libraries we mentioned earlier? What tricks do they enable?
At the time of writing, there are over 300 Python libraries in CI, and while the vast majority perform low-level tasks necessary to keep the ship running, there are some star performers who we should highlight. Need a word cloud of your text document? Need a QR code for your URL? CI has Python libraries that will do that quickly for you. It can also generate images and even animated gifs from Python code, and users have achieved remarkable results asking it to create everything from Spirograph patterns to Mandelbrot fractals. It’s not just images, either; there are also extensive audio and video manipulation libraries included, although their use is currently limited by various factors, and most tasks involving media files will be easier to solve using dedicated software.
Ultimately, the question of “what else can CI do” is open-ended; the combined power of GPT4’s language skills and Python’s programming enables a near-infinite array of possibilities, limited as much by our imagination as any technical issue. As people are discovering on OpenAI’s Discord, users are uncovering new ways to use CI every day, and there’s never been a better time to experiment!
This story is part of our weekly briefing. Sign up to receive the FREE briefing to your inbox.
Gadgets & Gifts
Put your spy skills to work with these fabulous choices from secret notepads & invisible inks to Hacker hoodies & high-tech handbags. We also have an exceptional range of rare spy books, including many signed first editions.
We all have valuable spy skills - your mission is to discover yours. See if you have what it takes to be a secret agent, with our authentic spy skills evaluation* developed by a former Head of Training at British Intelligence. It's FREE so share & compare with friends now!