Welcome to 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,Groq,Claude, 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.
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 π, Code-Interpreter can handle it all.
After processing your instructions, 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, 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 Code-Interpreter today! π
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
To install Code-Interpreter, run the following command:
pip install open-code-interpreter
interpreter -m 'gemini-pro' -md 'code' -dc
.env
file.To get started with Code-Interpreter, follow these steps:
git clone https://github.com/haseeb-heaven/code-interpreter.git
cd code-interpreter
pip install -r requirements.txt
Follow the steps below to obtain and set up the API keys for each service:
Obtain the API keys:
Save the API keys:
.env
file in your project root directory..env
file and add the following lines, replacing Your API Key
with the respective keys:export HUGGINGFACE_API_KEY="Your HuggingFace API Key"
export PALM_API_KEY="Your Google Palm API Key"
export GEMINI_API_KEY="Your Google Gemini API Key"
export OPENAI_API_KEY="Your OpenAI API Key"
export GROQ_API_KEY="Your Groq AI API Key"
export ANTHROPIC_API_KEY="Your Anthropic AI API Key"
This Interpreter supports offline models via LM Studio and OLlaMa so to download it from LM-Studio and Ollama follow the steps below.
ollama serve
and copy the URL. (OLlaMa will provide you with the URL).configs/local-model.config
and paste the URL in the api_base
field.local-model
and run the interpreter.Run the interpreter with Python:
python interpreter.py -md 'code' -m 'gpt-3.5-turbo' -dc
Run the interpreter directly:
./interpreter -md 'code' -m 'gpt-3.5-turbo' -dc
π Code Execution: 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 go using advanced editor.
π‘ Offline models: It has the ability to use offline models for code generation using LM Studio.
π 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, or command
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 uses Python
.
π Code Display: It can display the generated code in the output, allowing you to review the code before execution.
π» Cross-Platform: 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, Code-Interpreter can handle it all.
To use Code-Interpreter, use the following command options:
List of all programming languages are:
python
- Python programming language.javascript
- JavaScript programming language.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.chat
- Chat with your files and data.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.claude-2
- Generates code using the AnthropicAI Claude-2 model.claude-3
- Generates code using the AnthropicAI Claude-3 model.groq-mixtral
- Generates code using the Mixtral model using Groq LPU.groq-llama2
- Generates code using the Groq Llama2 model.groq-gemma
- Generates code using the Groq Gemma 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.local-model
- Generates code using the local offline 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'
Switching to File mode for prompt input (Here providing filename is optional)
python interpreter.py -m 'gemini-pro' -md 'code' --file 'my_prompt_file.txt'
Using Upgrade interpreter
python interpreter.py --upgrade
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 of 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./list
- List all the models/modes/language available./version
- Display the version of the interpreter./exit
- Exit the interpreter./debug
- Debug the generated code for errors./log
- Toggle different modes of logging./upgrade
- Upgrade the interpreter./prompt
- Switch the prompt mode File or Input modes./shell
- Access the shell.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.
To integrate your own API server for OpenAI instead of the default server, follow these steps:
Configs
directory.gpt-3.5-turbo.config
or gpt-4.config
.api_base = https://my-custom-base.com
Replace https://my-custom-base.com
with the URL of your custom API server.
gpt-3.5-turbo
or gpt-4
model, the system will automatically use your custom server..config
file and rename it to configs/hf-model-new.config
.start_sep
, end_sep
, skip_first_line
.HF_MODEL = 'Model name here'
.python interpreter.py -m 'hf-model-new' -md 'code' -e
.-m 'hf-model-new'
matches the config file inside the configs
folder.scripts
directory and run the config_builder
script .config_builder.sh
and for Windows, run config_builder.bat
..config
file for you.If you're interested in contributing to 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.
π 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:
π¨οΈ v1.9 - Added new Chat mode π¨οΈ for Chatting with your Files, Data and more.
π₯ v2.0 - Added Groq-AI Models Fastest LLM with 500 Tokens/Sec with Code-LLaMa, Mixtral models.
π₯ v2.1 - Added AnhtorpicAI Claude-3 models powerful Opus,Sonnet,Haiku models.
prompt.txt
file inside system
directory.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.
The Anthropic AI models are provided by Anthropic AI 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 Anthropic AI's Terms of Service.
This project is created and maintained by Haseeb-Heaven.