OpenAI took the world by storm, by releasing ChatGPT in November, 2022. While this release got the ball rolling on several other large language models across the tech industry, OpenAI also worked on improving its models and released them rapidly. In July 2023, OpenAI released the ChatGPT Code Interpreter for its ChatGPT Plus subscribers.
Read more: ChatGPT vs Google: Will ChatGPT Replace Search Engines?
What is the ChatGPT Code Interpreter?
ChatGPT, also known as Chat Generative Pre-trained Transformer, is a chatbot powered by a large language model (LLM) to retrieve information and serve it to the end user in human-like language. Currently, ChatGPT offers its users to use 2 LLMs: GPT 3.5 and GPT 4 (only for premium members) for its chatbot interaction.
ChatGPT Code Interpreter is an official ChatGPT plugin in the form of a sandboxed Python environment where you can execute Python code to perform any task you like – for instance, data analytics, image conversions, editing code, and more. Although it may sound like a feature built for coders, it can also help general users with a lot of tasks.
What can the ChatGPT Code Interpreter do?
A cool feature introduced by the OpenAI code interpreter is that you can now also upload and download your files, which was not possible in ChatGPT earlier. You can use your own files to run several operations: like convert a PDF file to text using OCR, trim a video file or change the format of the same, solve a mathematical problem, perform data analysis and visualization, create graphs, charts, among many other problems.
The OpenAI Code Interpreter basically provides a temporary disk space and computing space for your own files. This firewalled environment comes preinstalled with 300+ libraries and packages. An instance of how to use ChatGPT Code Interpreter can be understood using a very simple example here.
When you request the ChatGPT interpreter to convert an image-based PDF into a searchable format using OCR, it spontaneously generates a tailored Python script and promptly runs it. All you have to do is upload your PDF file, and it handles all the operations behind the scenes. You have the option to review the libraries it employs, identify any potential bottlenecks, and monitor its progress.
Similarly, you can also use it to run analysis and generate insights from your own data. It can solve mathematical problems – both quantitative and qualitative, do data analysis and visualize your results and convert files between different formats.
The Code Interpreter also has the capacity not just to generate code but also to execute it based on textual instructions. It serves as a versatile tool for aiding users in various aspects of debugging, including presenting alternative problem-solving methods, furnishing code snippets accompanied by explanations, and providing creative insights when users encounter challenges. When you submit your code, the interpreter can analyze it, propose enhancements, rectify errors, and execute the code for you.
But, important to note that the ChatGPT environment has certain limitations, with a significant one being its inability to access the internet to download new libraries. So the range of tasks it can handle is restricted to the libraries it has pre-existing support for.
How Does This Interpreter Work?
The OpenAI code interpreter or ChatGPT code interpreter primarily employs an RLHF (Reinforcement Learning from Human Feedback) model as its core architecture. Initially, this model undergoes pre-training, where it is exposed to a vast and diverse dataset comprising publicly available text encompassing various programming languages and code contexts.
This unsupervised learning phase enables the model to develop a comprehensive grasp of both language and code-related aspects, including syntax, semantics, and conventional practices.
Following the pre-training phase, the model enters a second stage known as fine-tuning. During this process, a smaller, meticulously curated dataset is employed, along with human feedback to align the model’s responses more closely with human-like interpretations.
Throughout this fine-tuning stage, the model’s outputs are continually compared to desired responses, and rewards are assigned based on the degree of alignment. These rewards serve as valuable feedback for the model, guiding its future outputs and facilitating improvement over time as it learns from each interaction.
How Can You Work with the OpenAI Code Interpreter?
The OpenAI code interpreter has currently only been released for ChatGPT plus members. To Upgrade to ChatGPT Plus, click on the “Upgrade to Plus” option on the bottom left corner when you first login to ChatGPT. It will cost you 20$ a month.
Once you have the ChatGPT Plus membership, you can activate your Code Interpreter plugin by clicking on the Beta features in the Settings menu.
Once you activate the Code Interpreter plugin, you’ll notice a small “+” symbol located on the left side of your text input field. This icon serves as a means to upload a variety of files, including Excel and Word documents, text files, and more.
You can then use prompts like you would normally, in ChatGPT to get descriptive analytics of the data you just uploaded. For example, using a prompt like “Describe this data” would give you the description of column headers and a general overview of the information covered in the dataset.
You can also use more complex queries to perform simple statistical operations and tests on the data. You can also use it to generate visualizations of the data and perform inquisitive analytics on the same.
Some Other Use Cases
The ChatGPT Code Interpreter allows you to import an image file and animate it. It might ask you for a few clarifications, but will finally generate a Python code to animate the image for you. You can also edit images by applying color corrections, black and white filters, and curve adjustments. You can also process audio files and perform simple operations like trimming the silent parts in the audio.
Although OpenAI hasn’t officially specified a file size limit, some individuals have reported successfully completing tasks with files as large as 170MB. It’s been observed that the ability to handle file size varies depending on factors such as file type and the specific task at hand. Generally, as file size increases, performance tends to degrade.