[ad_1]
Introduction
OpenAI just lately made Code Interpreter in ChatGPT accessible to all paying customers, however the $20 per 30 days value might not be reasonably priced for everybody. Nevertheless, if you wish to use ChatGPT Code Interpreter totally free, you are in luck. A developer named Shroominic has created an open-source implementation of ChatGPT’s Code Interpreter. With this implementation, you possibly can carry out dataset evaluation and visualize knowledge very like you’ll with ChatGPT. On this tutorial, we’ll stroll you thru the method of utilizing Code Interpreter totally free.
Issues to Preserve in Thoughts Earlier than You Proceed Additional
Utilizing the Free and Open-Supply Code Interpreter API Venture
At the beginning, we will probably be utilizing the Code Interpreter API mission, which is accessible totally free on GitHub. This mission makes use of CodeBoxes, OpenAI’s API, LangChain Brokers, and a number of Python packages to imitate the habits of ChatGPT’s Code Interpreter. It is efficient for small datasets and comes for gratis. Nevertheless, needless to say for those who plan to investigate massive quantities of knowledge, OpenAI’s fee restrict totally free customers might stop you from doing so. In that case, think about including a fee methodology to your OpenAI account.
Compatibility with GPT-3.5-turbo Mannequin
Whereas the Code Interpreter API works properly with the GPT-4 API, this specific tutorial focuses on making it suitable with the GPT-3.5-turbo mannequin. Therefore, we have now custom-made the code accordingly.
Step 1: Set Up Code Interpreter API
Python and Pip Set up
To get began, you should have Python and Pip put in in your pc. If you have not put in them but, you possibly can comply with our linked tutorial for steerage. Throughout the set up course of, make certain so as to add python.exe to the PATH.
Checking Python and Pip Setup
Upon getting Python and Pip put in, open the Terminal and run the next instructions to make sure they’re arrange correctly:
– python -version
– pip -version
These instructions ought to return the respective model numbers, confirming that Python and Pip are put in accurately.
Putting in the Code Interpreter API
Subsequent, run the next command to put in the Code Interpreter API:
– pip set up codeinterpreterapi
Acquiring an API Key
After the set up is full, go to OpenAI’s web site and purchase an API key. Click on on “Create new secret key” and replica the important thing.
Step 2: Run ChatGPT Code Interpreter for Free
Getting ready the Code Editor
To run the Code Interpreter API totally free, open a code editor like Chic Textual content or Notepad++ and proceed to the following step.
Including Code and Making Changes
Copy the code offered beneath and paste it into the code editor. This code is sourced from the GitHub web page of the Code Interpreter API, however we have now made a couple of modifications to forestall potential errors:
“`python
import os
os.environ[“OPENAI_API_KEY”] = “PASTE THE OPENAI API KEY HERE”
from codeinterpreterapi import CodeInterpreterSession
async def major():
# Create a session
session = CodeInterpreterSession(mannequin=”gpt-3.5-turbo”)
await session.astart()
# Generate a response primarily based on person enter
response = await session.generate_response(
“Plot the Apple inventory worth chart from 2007 to 2023 June”
)
# Output the response (textual content + picture)
print(“AI: “, response.content material)
for file in response.information:
file.show_image()
# Terminate the session
await session.astop()
if __name__ == “__main__”:
import asyncio
# Run the async perform
asyncio.run(major())
“`
Highlighted in crimson throughout the code are the areas that require modifications. First, paste your OpenAI API key within the second line. When you have entry to the GPT-4 API, you possibly can outline the “gpt-4” mannequin within the ninth line. Within the 14th line, you possibly can enter your question and outline what sort of chart you need to create.
Save this file as “chart.py” to your Desktop, making certain it has a .py extension.
Executing the Code
Open the Terminal and run the next instructions one after the other:
1. “`cd Desktop“`
2. “`python chart.py“`
Give it a couple of seconds, and the Code Interpreter API will generate the specified chart for you. This course of makes use of a number of background providers, together with LangChain Brokers, Yahoo Finance knowledge from the web, Matplotlib for plotting the graph, and extra. To view the detailed course of occurring within the background, you possibly can add the next line to the code:
– “`os.environ[“VERBOSE”] = “True”“`
From this level ahead, you possibly can merely modify the question within the code and rerun the “chart.py” file to generate new charts.
Step 3: Carry out Information Evaluation Utilizing Code Interpreter API
Organizing the Dataset
If you wish to carry out knowledge evaluation utilizing your individual native knowledge, begin by making a folder named “evaluation” in your Desktop.
Including the Dataset
Subsequent, transfer your dataset to the “evaluation” folder. The dataset might be in CSV, XSL, or XSLX format. For instance, let’s assume we have now a file named “globaltemperature.csv” contained in the “evaluation” folder.
Modifying the Code
Open the code editor and paste the next code:
“`python
import os
os.environ[“OPENAI_API_KEY”] = “PASTE THE OPENAI API KEY HERE”
from codeinterpreterapi import CodeInterpreterSession, File
async def major():
# Context supervisor for auto begin/cease of the session
async with CodeInterpreterSession(mannequin=”gpt-3.5-turbo”) as session:
# Outline the person request
user_request = “Analyze this dataset and plot international temperature from the 12 months 1950 to 2016. Contemplate the GCAG system.”
information = [File.from_path(“globaltemperature.csv”),]
# Generate the response
response = await session.generate_response(user_request, information=information)
# Output the response to the person
print(“AI: “, response.content material)
for file in response.information:
file.show_image()
if __name__ == “__main__”:
import asyncio
# Run the async perform
asyncio.run(major())
“`
Similar to the earlier code, make certain to stick your OpenAI API key. Moreover, exchange “globaltemperature.csv” with the identify of your dataset. You may also modify the mannequin and person question to fit your particular necessities.
Save this file as “knowledge.py” contained in the “evaluation” folder in your Desktop.
Operating the Code
Launch the Terminal and run the next instructions:
1. “`cd Desktop/evaluation“`
2. “`python knowledge.py“`
Consequently, you’ll obtain a chart primarily based in your native dataset. You could have efficiently utilized the Code Interpreter API for dataset evaluation with out incurring any charges.
Conclusion
On this tutorial, we explored the way to use Code Interpreter totally free by benefiting from the open-source implementation developed by Shroominic. By organising the Code Interpreter API, operating code totally free, and performing knowledge evaluation, you possibly can harness the ability of ChatGPT’s Code Interpreter with out the monetary burden of a paid subscription.
Regularly Requested Questions (FAQ)
1. Can I exploit OpenAI’s Code Interpreter totally free?
Sure, you should utilize Code Interpreter totally free by following the directions offered on this tutorial. The open-source implementation developed by Shroominic lets you make the most of Code Interpreter’s options with out incurring any fees.
2. What’s the price of OpenAI’s Code Interpreter?
OpenAI’s Code Interpreter is accessible to paying customers at a value of $20 per 30 days. Nevertheless, this tutorial guides you on the way to use it totally free by leveraging the open-source implementation.
3. What are the necessities for utilizing Code Interpreter totally free?
To make use of Code Interpreter totally free, you should have Python and Pip put in in your pc. Moreover, you’ll require an OpenAI API key, which might be obtained from OpenAI’s web site.
4. Can I exploit my very own dataset for knowledge evaluation with Code Interpreter?
Sure, you should utilize your individual dataset for knowledge evaluation with Code Interpreter. The tutorial offers detailed directions on the way to arrange the evaluation utilizing your native knowledge in CSV, XSL, or XSLX format.
5. What fashions are supported by the Code Interpreter API?
The Code Interpreter API helps varied fashions, together with GPT-3.5-turbo and probably GPT-4. You possibly can modify the code offered within the tutorial to make the most of completely different fashions primarily based in your necessities.
[ad_2]
For extra info, please refer this link