With the powerful ChatGPT Code Interpreter you can have tasks done in minutes that otherwise take hours or days. The plugin can create code and do advanced analysis on uploaded data. Here we present how it works.
What ChatGPT Code Interpreter can do
The “Code Interpreter” is a plugin for ChatGPT developed directly by OpenAI. It is available for users of the paid ChatGPT Plus (20€/month) since July 2023. The powerful extension translates the user’s question into self-generated Python code, reliably solving routine tasks that previously required programmers and analysts. The Code Interpreter is especially powerful because you can upload your own documents, such as a PDF or Excel files, and have them evaluated. This way, you get much more accurate answers than ever before. Because hallucinations are predominantly avoided by the generated code.
Key Facts:
- Name: ChatGPT Code Interpreter (Plugin)
- Developer: OpenAI
- More information: Plugin page from OpenAI
- Special Features: Analyze documents and data, visualize results graphically, upload your own documents
- Potential: very high. The plugin greatly shortens the work otherwise done by programmers, analysts or specialists.
- Cost: free for ChatGPT Plus users
How you can use Code Interpreter – from private to professional
Here are some everyday and professional examples where the versatile Code Interpreter helps. It is easy to see that Code Interpreter is a milestone in AI development and can save a lot of effort in data analysis and programming through automation. Moreover, it is extremely practical. ChatGPT can now easily solve many problems that are enormously time-consuming in everyday life and require specialists.
Examples: Tasks for the code interpreter
- Calculatecredit for a car or house purchase
- Summarize one or more uploaded documents or have them explained in simple language (e.g. tax, legal letters, technical documents, etc.)
- Identify and visualize ecommerce trends
- Shopping cart analysis: which products are often bought together?
- Visualize data as a time series chart or bar chart
- Calculate projects and check calculations (e.g. mass determination in construction projects, offer calculations and others)
- Evaluate marketing data: Google Search Console: Which search terms bring the most visitors?
- Evaluate Google Analytics 4: What trends in buying behavior can be identified?
- Convert file formats (e.g. png, gif, jpg, webp)
- Downloaddata as Excel, CSV as well as Powerpoint!
- Add images, e.g. place headlines on an image
- Analyze images, e.g. detect if people, objects, animals, plants are visible on an image
- and much more
How the Code Interpreter works
The Code Interpreter uses a concept that avoids some weaknesses of large language models (LLMs) and uses its strengths instead. This is because LLMs such as ChatGPT are able to translate a problem and instead of a direct answer as an intermediate step, generate a program code in the Python programming language, execute it and get the desired result from it. This method is called in technical term “Program-aided Large Language Models” (PAL)(PAL paper, PAL with LangChain).
Step-by-step explanation:
- Question: the user enters his question and required information into ChatGPT (e.g., “I want to calculate a loan”)
- Upload document: If important for the task, one can upload another document for it (Attention: Pay attention to privacy!) – Tip: One can also upload several documents. Either one after the other or as a ZIP file.
- Create procedure: The ChatGPT code interpreter creates a flow of the substeps to be executed (e.g. 1. calculate loan amount, 2. calculate rate, 3. show summary)
- Create Python code: Relevant subtasks are translated into Python scripts (e.g., calculate required loan amount for home purchase)
- Execute Python code: The script is executed (e.g. result: 220.000€)
- Continue using result: The result of the script is used for further steps (e.g. calculate monthly loan installment)
- Complete task: When the overall goal is reached, ChatGPT finishes its output.
- Ask follow-up questions: If desired, you can now ask further follow-up questions again. So this is possible like a dialog with a human or a consultant. ChatGPT thus preserves what has been learned so far and can answer even more specifically.
Which file formats can Code Interpreter use?
ChatGPT can handle diverse formats from different application areas, as it can generate its output through Python. Thus, ChatGPT can generate any kind of document for which ChatGPT has learned a format definition during training and for which Python libraries exist. It is worth trying out which formats can be generated for this purpose.
File formats usable in Code Interpreter (examples):
- Text formats:
- txt, doc, docx, rtf, html
- Compression methods:
- zip, gzip
- Table and data formats:
- .csv, Excel (.xls, .xlsx), .ods, json
- Presentation formats:
- ppt, pptx
- Image formats:
- .png, .jpg, .jpeg, .bmp, .gif
- Video formats
- mp4, avi, mov
- Audio formats
- mp3, wav, ogg, raw
- Databases
- .sql, .sqlite, .db
- Statistics data formats
- SPSS, Stata
- Medical data formats
- DICOM: standard format for medical images, such as CT scans, MRIs and X-rays
- FASTA/FASTQ: Formats used in bioinformatics for storing DNA, RNA and protein sequences.
- VCF (Variant Call Format): A format used to store genome sequence variations.
- Business Processes
- BPMN (“Business Process Model and Notation”): The standardized diagramming language for modeling business processes
- Architecture/Civil Engineering:
- DWG/DXF: The format of the architecture software AutoCAD
- SKP: The format of SketchUp, a 3D modeling tool.
- many more
Limitations: What can’t Code Interpreter do?
As powerful as Code Interpreter is, there are currently the following limitations:
- No Internet access: Code Interpreter cannot retrieve data from the Internet. It also cannot execute code that would allow it to do so
- No knowledge prior to training time: Code Interpreter uses GPT-4 as its base model. So you can’t use current knowledge e.g. from news, politics etc
Workaround: Since you can upload your own files, these limitations can be partially worked around by using a suitable file upload.
Example: Calculate credit for a house purchase with the ChatGPT Code Interpreter
The following example shows how powerful the code interpreter is. For a loan calculation you needed until now a calculator of a construction financing provider or even an appointment with a financial advisor. Now the code interpreter of ChatGPT can give an answer directly.
Here is the used prompt to try it yourself:
Prompt: Loan for a house purchase
Calculate a construction financing. - Purchase price: 320000€ - available capital: 100000€ - interest rate: 3,5% - additional purchase costs: 12% Calculate the required credit and the monthly amount. Compare the following repayment periods: 10, 15, 20, 30 years Give a summary in the form of a table. Output the loan repayment history as a time series chart.
Result:
ChatGPT calculates and explains the loan calculation in detail and impressively. If you wish, you can of course request a simpler or more complex explanation via prompt at any time, depending on how detailed you want to know. Since the result is quite extensive, we’ll go through it step by step here.
Output 1: ChatGPT explains the procedure and even shows formulas for calculating the monthly payment of the loan
Output 2: Calculation of the loan amount
You can see where the code interpreter now performs its calculations and you can expand and view them at any time. In doing so, ChatGPT continues to calculate with previously calculated intermediate results at any time.
Output 3: Table visualization of the monthly payment and remaining amounts.
Output 4: Visualization of the payoff
Very impressively, the code Interpeter can create nifty Python visualizations with matplotlib or seaborn at any time. This makes almost any visualization possible, from line charts, bar charts, scatter plots and many more(see matplotlib visualizations). Here you can see how much debt remains if you want to pay off your loan 10, 15, 20 or 30 years. This helps immensely with the decision. If you wish, you can now use a follow-up question to ChatGPT to go through it further (e.g. : “Show years instead of months”, “Use different colors” etc.)
Output 5: Data visualization details
Looking at the output of the code interpeter, you can quickly see how ChatGPT created the chart here using the popular matplotlib library.
Output 6: Summary
Finally, the desired summary follows, in which ChatGPT independently includes everything important.
Example: Download data as Excel or Powerpoint
Practical: After you have made your analyses with the code interpreter, you can also download them in the desired format. This can be e.g. CSV, Excel but also Powerpoint or Word.
Here is an example how to download table data in Excel format:
Download data in Powerpoint format:
Result: Data in pptx format for Powerpoint
More application examples: What Code Interpreter can do
- 121Watt: Data analysis with Code Interpreter – analyze SEO data, trend correlation analysis with Google Trends and more
- Computer vision with Code Inter preter – detect and track objects in images, data visualization, detect text on images and more
Conclusion: Code Interpeter for ChatGPT is a real gamechanger
Hardly any plugin is more powerful than Code Interpreter. Professionally, this will have great influences on the daily work of web analysts, BI specialists, coders, data visualizers. Likewise, in the private and leisure sector, one can now simplify numerous tasks with this plugin, from the shown credit to the support with the budget book, travel planning, planning renovations and purchases and much more.