Ask GPT-4 to run code locally.
Project description
Open Interpreter
Open Interpreter is a lightweight, open-source implementation of OpenAI's Code Interpreter.
interpreter.chat("Add subtitles to video.mp4 on my Desktop.")
>>> On it. First, I'll check if any speech-to-text libraries are installed...
Illustration created by Open Interpreter. Inspired by Ruby Chen's GPT-4 artwork.
Demo Notebook
Features
- Generated code runs locally.
- Uses
pip
andapt-get
to extend itself. - Interactive, streaming chat inside your terminal.
Quick Start
pip install open-interpreter
import interpreter
interpreter.api_key = "<your_openai_api_key>"
# Start an interactive chat in your terminal
interpreter.chat()
Use Cases
Open Interpreter acts as a seasoned programmer that can execute code snippets to accomplish tasks.
- Add subtitles to all videos in a folder.
- Blur all faces in a photo or video.
- Edit a large batch of documents.
...
Comparison to ChatGPT's Code Interpreter
OpenAI's recent release of Code Interpreter with GPT-4 presents a fantastic opportunity to accomplish real-world tasks with ChatGPT.
However, OpenAI's service is hosted, closed-source, and heavily restricted:
- No internet access.
- Limited set of pre-installed packages.
- 100 MB maximum upload, 120.0 second runtime limit.
- State is cleared (along with any generated files or links) when the environment dies.
Open Interpreter overcomes these limitations by running in a stateful Jupyter notebook on your local environment. It has full access to the internet, isn't restricted by time or file size, and can utilize any package or library.
Open Interpreter combines the power of GPT-4's Code Interpreter with the flexibility of your local development environment.
Commands
Terminal Chat
Running .chat()
will start an interactive session in your terminal:
interpreter.chat()
Python Chat
For more precise control, you can pass messages directly to .chat(message)
:
interpreter.chat("Add subtitles to all videos in /videos.")
# ... Streams output to your terminal, completes task ...
interpreter.chat("These look great but can you make the subtitles bigger?")
# ...
Start a New Chat
By default, Open Interpreter remembers conversation history. If you want to start fresh, you can reset it:
interpreter.reset()
Then start a chat as described above.
Save and Restore Chats
interpreter.chat()
returns a List of messages, which can be restored with interpreter.load(messages)
:
interpreter.load(chat)
Customize System Message
You can inspect and configure Open Interpreter's system message to extend its functionality, modify permissions, or give it more context.
interpreter.system_message += """
Run shell commands with -y so the user doesn't have to confirm them.
"""
print(interpreter.system_message)
How Does it Work?
Open Interpreter equips a function-calling GPT-4 with the exec()
function.
We then stream the model's messages, code, and your system's outputs to the terminal as Markdown.
Only the last model_max_tokens
of the conversation are shown to the model, so conversations can be any length, but older messages may be forgotten.
Contributing
As an open-source project, we are extremely open to contributions, whether it be in the form of a new feature, improved infrastructure, or better documentation.
License
Open Interpreter is licensed under the MIT License. You are permitted to use, copy, modify, distribute, sublicense and sell copies of the software.
Note: This software is not affiliated with OpenAI.
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_interpreter-0.0.228-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a10f9cfdf758b826991c9fa735b6370e4f0bc47f84318ebddf2606f28aa5783b |
|
MD5 | da993b38bcb98dfaff9d43bbc72f0898 |
|
BLAKE2b-256 | 9e6dea384125367b53d90e8216b9e56c91bd713df6ffe7d438e083c9b8f2a7e8 |