An innovative open-source Code Interpreter with (GPT,Gemini,PALM,LLaMa) models.
Project description
Hosting and Spaces:
Support Project:
Welcome to Open-Code-Interpreter ๐, an innovative open-source and free alternative to traditional Code Interpreters. This is powerful tool and it also leverages the power of GPT 3.5 Turbo,PALM 2, HuggingFace models like Code-llama, Mistral 7b, Wizard Coder, and many more to transform your instructions into executable code for free and safe to use environments and even has Vision Models for Image Processing available.
Open-Code-Interpreter is more than just a code generator. It's a versatile tool that can execute a wide range of tasks. Whether you need to find files in your system ๐, save images from a website and convert them into a different format ๐ผ๏ธ, create a GIF ๐๏ธ, edit videos ๐ฅ, or even analyze files for data analysis and creating graphs ๐, Open-Code-Interpreter can handle it all.
After processing your instructions, Open-Code-Interpreter executes the generated code and provides you with the result. This makes it an invaluable tool for developers ๐ป, data scientists ๐งช, and anyone who needs to quickly turn ideas into working code and now with Vision Models it can also process images and videos.
Designed with versatility in mind, Open-Code-Interpreter works seamlessly on every operating system, including Windows, MacOS, and Linux. So, no matter what platform you're on, you can take advantage of this powerful tool ๐ช.
Experience the future of code interpretation with Open-Code-Interpreter today! ๐
Why this is Unique Interpreter?
The distinguishing feature of this interpreter, as compared to others, is its commitment to remain free ๐. It does not require any model to download or follow to tedious processes or methods for execution. It is designed to be simple and free for all users and works on all major OS Windows,Linux,MacOS
Future Plans:
๐ฏ We plan to integrate GPT 3.5 models.๐ฏ We have added support for GPT 3.5 models.- ๐ .
We plan to provide Vertex AI (PALM 2) models..We have added support for PALM-2 model using LiteLLM - ๐
We plan to provide API Base change using LiteLLM. Added Support for LiteLLM - ๐ค More Hugging Face models with free-tier.
- ๐ป Support for more Operating Systems.
- ๐ Support for Multi-Modal for Text and Vision.
- ๐ Support for Google and OpenAI Vision Models.
Table of Contents
๐ฅ Installation
Installtion with Python package manager.
To install Open-Code-Interpreter, run the following command:
pip install open-code-interpreter
- To run the interpreter with Python:
interpreter -m 'gemini-pro' -md 'code' -dc
- Make sure you install required packages before running the interpreter.
- And you have API keys setup in the
.env
file.
Installtion with Git
To get started with Open-Code-Interpreter, follow these steps:
- Clone the repository:
git clone https://github.com/haseeb-heaven/open-code-interpreter.git
cd open-code-interpreter
- Install the required packages:
pip install -r requirements.txt
- Setup the Keys required.
HUGGING FACE API Key setup.
Step 1: Obtain the HuggingFace API key.
Step 2: Visit the following URL: https://huggingface.co/settings/tokens and get your Access Token.
Step 3: Save the token in a .env
file as:
echo "HUGGINGFACE_API_KEY=Your Access Token" > .env
Google GEMINI and PALM-2 API Key setup.
Step 1: Obtain the Google Palm API key.
Step 2: Visit the following URL: https://makersuite.google.com/app/apikey
Step 3: Click on the Create API Key button.
Step 4: The generated key is your API key. Please make sure to copy it and paste it in the required field below.
echo "PALM_API_KEY=Your API Key" > .env
echo "GEMINI_API_KEY=Your API Key" > .env
OpenAI API Key setup.
Step 1: Obtain the OpenAI API key.
Step 2: Visit the following URL: https://platform.openai.com/account/api-keys
Step 3: Sign up for an account or log in if you already have one.
Step 4: Navigate to the API section in your account dashboard.
Step 5: Click on the Create New Key button.
Step 6: The generated key is your API key. Please make sure to copy it and paste it in the required field below.
echo "OPENAI_API_KEY=Your API Key" > .env
- Run the interpreter with Python:
Running with Python.
python interpreter.py -md 'code' -m 'gpt-3.5-turbo' -dc
- Run the interpreter directly:
Running Interpreter without Python (Executable MacOs/Linux only).
./interpreter -md 'code' -m 'gpt-3.5-turbo' -dc
๐ Features
-
๐ Code Execution: Open-Code-Interpreter can execute the code generated from your instructions.
-
๐พ Code Save/Update: It has the ability to save the generated code for future use and edit the code if needed on the fly using advanced editor.
-
๐ Command History: It has the ability to save all the commands as history.
-
๐ Command Mode: Commands entered with '/' are executed as commands like
/execute
or/edit
. -
๐ Mode Selection: It allows you to select the mode of operation. You can choose from
code
for generating code,script
for generating shell scripts, orcommand
for generating single line commands. -
๐ง Model Selection: You can set the model for code generation. By default, it uses the
code-llama
model. -
๐ Language Selection: You can set the interpreter language to Python or
JavaScript
. By default, it usesPython
. -
๐ Code Display: It can display the generated code in the output, allowing you to review the code before execution.
-
๐ป Cross-Platform: Open-Code-Interpreter works seamlessly on every operating system, including Windows, MacOS, and Linux.
-
๐ค Integration with HuggingFace: It leverages the power of HuggingFace models like Code-llama, Mistral 7b, Wizard Coder, and many more to transform your instructions into executable code.
-
๐ฏ Versatility: Whether you need to find files in your system, save images from a website and convert them into a different format, create a GIF, edit videos, or even analyze files for data analysis and creating graphs, Open-Code-Interpreter can handle it all.
๐ ๏ธ Usage
To use Open-Code-Interpreter, use the following command options:
-
List of all modes are:
code
- Generates code from your instructions.script
- Generates shell scripts from your instructions.command
- Generates single line commands from your instructions.vision
- Generates description of image or video.
-
List of all models are (Contribute - MORE):
gpt-3.5-turbo
- Generates code using the GPT 3.5 Turbo model.gpt-4
- Generates code using the GPT 4 model.gemini-pro
- Generates code using the Gemini Pro model.palm-2
- Generates code using the PALM 2 model.code-llama
- Generates code using the Code-llama model.code-llama-phind
- Generates code using the Code-llama Phind model.mistral-7b
- Generates code using the Mistral 7b model.wizard-coder
- Generates code using the Wizard Coder model.star-chat
- Generates code using the Star Chat model.
-
Basic usage (with least options)
python interpreter.py -dc
- Using different models (replace 'model-name' with your chosen model)
python interpreter.py -md 'code' -m 'model-name' -dc
- Using different modes (replace 'mode-name' with your chosen mode)
python interpreter.py -m 'model-name' -md 'mode-name'
- Using auto execution
python interpreter.py -m 'wizard-coder' -md 'code' -dc -e
- Saving the code
python interpreter.py -m 'code-llama' -md 'code' -s
- Selecting a language (replace 'language-name' with your chosen language)
python interpreter.py -m 'gemini-pro' -md 'code' -s -l 'language-name'
Interpreter Commands ๐ฅ๏ธ
Here are the available commands:
- ๐
/save
- Save the last code generated. - โ๏ธ
/edit
- Edit the last code generated. - โถ๏ธ
/execute
- Execute the last code generated. - ๐
/mode
- Change the mode of interpreter. - ๐
/model
- Change the model for interpreter. - ๐ฆ
/install
- Install a package from npm or pip. - ๐
/language
- Change the language of the interpreter. - ๐งน
/clear
- Clear the screen. - ๐
/help
- Display this help message. - ๐
/version
- Display the version of the interpreter. - ๐ช
/exit
- Exit the interpreter. - ๐
/log
- Display the log. - โซ
/upgrade
- Upgrade the interpreter. - ๐ป
/shell
- Access the shell.
๐ Examples
Example of GPT 3.5 Turbo.
Example of PALM-2 based on Google Vertex AI.
Example of Code llama with code mode:
Example of Code llama with command mode:
Example of Mistral with code mode:
โ๏ธ Settings
You can customize the settings of the current model from the .config
file. It contains all the necessary parameters such as temperature
, max_tokens
, and more.
Steps to add your own custom API Server
To integrate your own API server for OpenAI instead of the default server, follow these steps:
- Navigate to the
Configs
directory. - Open the configuration file for the model you want to modify. This could be either
gpt-3.5-turbo.config
orgpt-4.config
. - Add the following line at the end of the file:
Replaceapi_base = https://my-custom-base.com
https://my-custom-base.com
with the URL of your custom API server. - Save and close the file.
Now, whenever you select the
gpt-3.5-turbo
orgpt-4
model, the system will automatically use your custom server.
Steps to add new Hugging Face model
- ๐ Copy the
.config
file and rename it toconfigs/hf-model-new.config
. - ๐ ๏ธ Modify the parameters of the model like
start_sep
,end_sep
,skip_first_line
. - ๐ Set the model name from Hugging Face to
HF_MODEL = 'Model name here'
. - ๐ Now, you can use it like this:
python interpreter.py -m 'hf-model-new' -md 'code' -e
. - ๐ Make sure the
-m 'hf-model-new'
matches the config file inside theconfigs
folder.
๐ค Contributing
If you're interested in contributing to Open-Code-Interpreter, we'd love to have you! Please fork the repository and submit a pull request. We welcome all contributions and are always eager to hear your feedback and suggestions for improvements.
๐ Versioning
๐ Versioning
๐ v1.0 - Initial release.
๐ v1.1 - Added Graphs and Charts support.
๐ฅ v1.2 - Added LiteLLM Support.
๐ v1.3 - Added GPT 3.5 Support.
๐ด v1.4 - Added PALM 2 Support.
๐ v1.5 - Added GPT 3.5/4 models official Support.
๐ v1.6 - Updated Code Interpreter for Documents files (JSON, CSV,XML).
๐ด v1.7 - Added Gemini Pro Vision Support for Image Processing.
๐ด v1.8 - Added Interpreter Commands Support.
- 1.8.1 - Added Interpreter Commands Debugging Support.
- 1.8.2 - Fixed Interpreter Commands
- 1.8.3 - Added Interpreter Commands Upgrade and Shell Support.
- 1.8.4 - Fixed Interpreter Model switcher Bug.
๐ License
This project is licensed under the MIT License. For more details, please refer to the LICENSE file.
Please note the following additional licensing details:
-
The GPT 3.5/4 models are provided by OpenAI and are governed by their own licensing terms. Please ensure you have read and agreed to their terms before using these models. More information can be found at OpenAI's Terms of Use.
-
The PALM models are officially supported by the Google PALM 2 API. These models have their own licensing terms and support. Please ensure you have read and agreed to their terms before using these models. More information can be found at Google Generative AI's Terms of Service.
-
The Hugging Face models are provided by Hugging Face Inc. and are governed by their own licensing terms. Please ensure you have read and agreed to their terms before using these models. More information can be found at Hugging Face's Terms of Service.
๐ Acknowledgments
- We would like to express our gratitude to HuggingFace,Google,META,OpenAI for providing the models.
- A special shout-out to the open-source community. Your continuous support and contributions are invaluable to us.
๐ Author
This project is created and maintained by Haseeb-Heaven.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for open_code_interpreter-1.8.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 701d068c57d5beb2e30ff8f9227c6e494cfef38e8877181283d7ef7342ff8ef6 |
|
MD5 | e394cded4e5c97ef263bae898cb8f9cb |
|
BLAKE2b-256 | a1fb0ca4a0bba2854235fa2bc8413d37f3f21a8cc4779a566320265385bbafca |
Hashes for open_code_interpreter-1.8.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 030e410e2174029188fd5deb595a1dcf23e962008ac7b8b31d01fc414782c3c0 |
|
MD5 | a98d8cc991e4d3ba6488991e92b85ba7 |
|
BLAKE2b-256 | 7453cf668a5a7a3f07e083303348364f2f0b31ab3e40ca22c6699c25d349a7ad |