ChatGPT Code Interpreter: What It Is and How It Works

Join over 2 million students who advanced their careers with 365 Data Science. Learn from instructors who have worked at Meta, Spotify, Google, IKEA, Netflix, and Coca-Cola and master Python, SQL, Excel, machine learning, data analysis, AI fundamentals, and more.

Start for Free
Aleksandra Yosifova 15 Apr 2024 7 min read

Open AI releases new and improved AI tools faster than we can learn how to use them. Just when the world started to get used to ChatGPT and the changes that came with it, Open AI introduced Code Interpreter.

Now ChatGPT can do everything, and it has data professionals worldwide worried. Will it replace their jobs or create new opportunities?

We’re optimistic. We believe Code Interpreter will increase the demand for skilled data experts and democratize the field. Why?

Code Interpreter opens the door to the world of data analysis to those who previously lacked the knowledge and skills to take advantage of it. And the more business stakeholders work with data, the more questions they will have; therefore, the higher the demand for skilled data professionals will be.

This article explains how Code Interpreter works, its applications, how to effectively use it, and its limitations.

Table of Contents

What Is ChatGPT Code Interpreter?

Code Interpreter is a new Open AI GPT-4 feature that combines the immense analytical power of large language models (LLMs) with programming. It allows you to run Python code and upload files, significantly increasing the scope of tasks ChatGPT can perform.

How to Access the ChatGPT Code Interpreter

As of July 2023, Code Interpreter is only available to premium ChatGPT Plus users. Once you subscribe, log into your account, go to the bottom left of the screen, and click Settings. Open ‘Beta features’ and enable the Code Interpreter toggle. (From there, you can also activate the ChatGPT plugins.)

A screenshot of the Code Interpreter activation settings

When starting a new conversation in ChatGPT, you can select which model you wish to use. (Note that you cannot switch models afterward.) Click ‘New chat’ (top left corner), position your cursor on the GPT-4 icon (top middle of the screen), and select Code Interpreter from the drop-down menu.

How Does ChatGPT Code Interpreter Work?

Code Interpreter is a GPT-4 feature. The technology behind it and how it was trained are the same as for the standard ChatGPT model. (The article ChatGPT: How to Understand and Compete with the AI Bot explains in detail how the technology behind ChatGPT works.)

The difference between the standard ChatGPT model and Code Interpreter is the type of input they accept and the provided output. You’re probably aware that the instructions you can provide to ChatGPT have a word limit.

If you wish to perform a complex task with ChatGPT3.5 or ChatGPT4.0, you need to tweak your instructions multiple times, adding more depth until the AI fully understands the task. And even then, you still can’t work with large datasets.

Uploading files into Code Interpreter lets you feed it with much more information. You can supplement your verbal instructions with a file, providing a richer context.

This removes another barrier, too. Although you can converse with the AI, it’s still a machine. As such, Code Interpreter understands code and data better than text input. This leaves less room for interpretation, reducing the likelihood of mistakes and increasing ChatGPT’s capabilities.

The following analogy better illustrates this difference.

Suppose you have a technical issue and call support to solve it. We’ve all been there and can imagine the frustration of describing the problem and trying to understand and implement the seemingly useless suggestions the agent provides.

Now imagine having a video call and sharing your screen with tech support. You can explain and simultaneously demonstrate the problem. With this richer understanding, the agent can provide better solutions or even gain remote access to your computer and solve the problem.

That’s why the seemingly small change of being able to upload files to Code Interpreter is an enormous benefit.

Another crucial difference is the output Code Interpreter provides. While with the default GPT-4, you receive a text output or a code you can use, Code Interpreter runs the code for you and provides the ready-made output. Plus, it lets you see how it arrived at the result, so you can still run the code yourself.

This makes it useful for tech-savvy individuals and professionals who want to save themselves hours of work by delegating more straightforward tasks to ChatGPT or getting help when they’re stuck with a problem. Better yet, it makes specific solutions accessible to less tech-savvy individuals, empowering them to conduct tasks requiring programming without knowing how to write a single line of code.

Using Code Interpreter, however, for tasks beyond your knowledge and capabilities can do more harm than good. You must understand the task you’re asking ChatGPT to perform to provide accurate and useful instructions. And you must be able to verify the output because, as advanced as it is, every technology is prone to errors.

How to Use ChatGPT Code Interpreter

According to Open AI, Code Interpreter’s primary functions include data analysis, image conversions, and editing code files.

You can upload various file formats, including:

  • Text (.txt, .csv, .json, .xml, etc.)
  • Image (.jpg, .png, .gif, etc.)
  • Document (.pdf, .docx, .xlsx, .pptx, etc.)
  • Code (.py, .js, .html, .css, etc.)
  • Data (.csv, .xlsx, .tsv, .json, etc.)
  • Audio (.mp3, .wav, etc.)
  • Video (.mp4, .avi, .mov, etc.)

But Code Interpreter doesn’t do equally well with all file types. Its performance varies significantly between tasks and depends on the provided input and instructions—like with the standard GPT-4 model.

Images, Audio, Video

Code Interpreter cannot describe or generate images but can edit them—e.g., by applying color corrections, black and white filters, and curve adjustments.

Screenshot from a chat with Code Interpreter making an image of the Python logo black and white.

Although some have reportedly transcribed audio files with Code Interpreter, we couldn’t do so. But we did manage to trim the silent parts in the audio. The results were excellent.

Screenshot of an audio before Code Interpreter has trimmed the silent parts.

Audio before the trimming

Screenshot of an audio after Code Interpreter has trimmed the silent parts.

Audio after the trimming

 

Moreover, Code Interpreter can convert video files into other formats and trim and edit them (e.g., adjust the colors), but only for short and lower-resolution videos.

Screenshot from a chat with Code Interpreter converting an MP4 to an MP3 file.

If the requested task requires more computing power, the AI automatically interrupts the execution after 60 seconds. This suggests some threshold, depending on the task complexity, the time needed to complete it, and the file size.

Open AI hasn’t stated an official file size limit. Some have reported successfully performing tasks with files up to 170MB. But our experience shows that this depends on the file type and task, and performance deteriorates as the size increases.

Text

Code Interpreter works better with Word than with PDF files. It can only handle PDFs containing text. Images, tables, multi-column layouts, and sophisticated formatting impact its ability to summarize the text and extract information. And while it can convert PDF into .docx files, the outcome is messy unless the file contains only text and simple formatting.

With Word files, Code Interpreter can answer specific questions about the text, summarize it, determine its sentiment, suggest keywords for search engine optimization depending on the topic and content, etc. Its text processing capabilities don’t differ significantly from those of the standard ChatGPT model. The primary improvement is the extended word limit that comes with the ability to upload files.

Code

Code Interpreter not only writes but also runs code based on written instructions. It can help you explore different approaches to solving a problem, provide code samples and explanations, and offer ideas when you’re stuck.

If you upload your code, it can review it, suggest improvements, fix errors, and run it. But the ChatGPT environment has limited capabilities—the major one being that it cannot download new libraries because it doesn’t have internet access. So, the tasks it can solve are limited by the libraries it supports.

Data

Data analysis and visualization are where Code Interpreter truly shines.

The AI handles structured data exceptionally well. You can upload Excel spreadsheets, CSV files, etc., and instruct Code Interpreter to describe the data, process, analyze, visualize, and interpret it.

When you first upload your data file, ensure that ChatGPT understands it. You can ask specific questions about the data and correct the mistakes in its response or describe the data yourself to avoid any confusion.

Code Interpreter can deal with duplicate rows, inaccurate data, and unit discrepancies, detect outliers, check for errors, clean, preprocess, analyze, visualize data, etc. If you know what you’re doing, it can become your personal analysis assistant.

Our upcoming Data Analysis with ChatGPT Code Interpreter course teaches you how to leverage Code Interpreter’s data analysis capabilities. The release date is approaching, so keep an eye on our Courses Library.

ChatGPT Code Interpreter Limitations

Code Interpreter’s capabilities are powerful, and it’s less prone to errors than the default GPT-4 model, but it still has several significant flaws.

For starters, Code Interpreter cannot connect to the internet or APIs for security reasons, so you can’t feed it with real-time data.

Moreover, it cannot connect to databases—the leading way organizations collect data. Until that’s resolved, you must download the necessary information and upload the CSV or Excel files to the ChatGPT environment.

Another limitation is that you cannot upload files of all sizes. Anything above a few hundred megabytes is problematic. And even if large files do load, Code Interpreter isn’t equipped to handle high-performance computing—its CPU power is limited.

This is linked to the following problem: Each execution cell has a time limit. It automatically stops if your code doesn’t finish executing within this limit. So, at least for now, you can’t perform complex tasks on large files.

Even if you don’t exceed the execution cell limit, you’ll reach the session time limit. And if your session times out or you exit the chat and return later, your previous work will be lost. You can continue the conversation, but previous files, links, and code blocks won’t work as expected.

Most importantly, ChatGPT needs plenty of debugging. Code Interpreter is less prone to mistakes, especially if your data is well structured and the task is straightforward, but errors still occur. The only solution is to prompt ChatGPT to print the results after each step. This will allow you to catch any mistakes and explain more precisely the desired output. The AI will self-correct and fix them.

Useful Tips and Workarounds

When using Code Interpreter, you need to be aware of its limitations and follow some best practices to ensure the quality and integrity of the results.

It’s crucial to consider ethics and privacy when uploading personal or company data—we’ve already experienced an Open AI data breach, and it’s probably the first of many. So, ensure you aren’t uploading sensitive or private information.

Give ChatGPT plenty of context about the file’s content, purpose, task, and what you wish to achieve. Be specific about the output, providing detailed instructions on the desired results and how you want to receive them.

Our Intro to ChatGPT and Generative AI course teaches you how to prompt effectively using the 5Ws and 1H questions. Of course, not all tasks require detailed instructions. The amount of detail should be proportional to the task complexity.

Regardless of the file format, the chances of achieving your desired output are more significant if you break down the task into smaller parts. Provide one instruction at a time; otherwise, Code Interpret may become overwhelmed and cease the task completion or complete only one of your requests. This may take slightly longer, but it’s the more effective approach.

Lastly, ensure your work won’t get lost because of Code Interpreter’s session time limit. This issue will likely be solved with future versions, but the following is good practice.

If you’re working on a more complex and time-consuming task, ask the AI to provide a downloadable file with the results every few steps and save it on your computer. This way, you won’t need to start from scratch if something goes wrong. It’s like saving or backing up your data.

Will Code Interpreter Replace Data Scientists and Analysts?

In a LinkedIn post, Luke Barousse (a renowned data expert and internet personality) provided an insightful answer to this question. He referenced the time before the spreadsheet migrated to a computer when companies had teams of multiple accountants performing calculations manually. When Excel was invented, it enabled a single person to perform tasks that previously required numerous individuals and hours of work.

Excel disrupted the financial sector, but did it replace the experts?

No, it facilitated and automated mundane tasks, allowing professionals to focus on higher-level analyses and help businesses to expand more quickly.

This example perfectly illustrates how technological advancement doesn’t equal unemployment. On the contrary, it can lead to the creation of more jobs and more meaningful work.

ChatGPT is a work disruptor. Code Interpreter will likely be one, too. Still, it also has the potential to democratize data analytics and data science and increase the demand for highly skilled experts who can take the field to the next level.

Next Steps

If you wish to be among the highly skilled experts of tomorrow, you need to embrace new technologies and use them to your advantage. Our courses, Intro to ChatGPT and Generative AI, Data Analysis in Power BI with ChatGPT, and Data Analysis with ChatGPT Code Interpreter, can help you with this.

But you need a solid theoretical background, technical and soft skills, and business understanding to be a successful data expert. 365 Data Science’s program equips you with the necessary knowledge—starting from the basics and gradually building your expertise. Sign up to try the program for free and start building your dream career.

Aleksandra Yosifova

Blog author at 365 Data Science

Aleksandra is a Copywriter and Editor at 365 Data Science. She holds a bachelor’s degree in Psychology and is currently pursuing a Master’s in Cognitive Science. Thanks to her background in both research and writing, she learned how to deliver complex ideas in simple terms. She believes that knowledge empowers people and science should be accessible to all. Her passion for science communication brought her to 365 Data Science.

Top