Update: ● 0.1.12 supports --vision
(experimental).
pip install open-interpreter
Open Interpreter lets LLMs run code (Python, Javascript, Shell, and more) locally. You can chat with Open Interpreter through a ChatGPT-like interface in your terminal by running $ interpreter
after installing.
This provides a natural-language interface to your computer’s general-purpose capabilities:
- Create and edit photos, videos, PDFs, etc.
- Control a Chrome browser to perform research
- Plot, clean, and analyze large datasets
- …etc.
Demo
Open.Interpreter.Demo.mp4
An interactive demo is also available on Google Colab:
Along with an example implementation of a voice interface (inspired by Her):
Quick Start
pip install open-interpreter
Terminal
After installation, simply run interpreter
:
Python
import interpreter interpreter.chat("Plot AAPL and META's normalized stock prices") # Executes a single command interpreter.chat() # Starts an interactive chat
Comparison to ChatGPT’s Code Interpreter
OpenAI’s 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 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.
This combines the power of GPT-4’s Code Interpreter with the flexibility of your local development environment.
Commands
Update: The Generator Update (0.1.5) introduced streaming:
message = "What operating system are we on?" for chunk in interpreter.chat(message, display=False, stream=True): print(chunk)
Interactive Chat
To start an interactive chat in your terminal, either run interpreter
from the command line:
Or interpreter.chat()
from a .py file:
You can also stream each chunk:
message = "What operating system are we on?" for chunk in interpreter.chat(message, display=False, stream=True): print(chunk)
Programmatic 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
In Python, Open Interpreter remembers conversation history. If you want to start fresh, you can reset it:
Save and Restore Chats
interpreter.chat()
returns a List of messages, which can be used to resume a conversation with interpreter.messages = messages
:
messages = interpreter.chat("My name is Killian.") # Save messages to 'messages' interpreter.reset() # Reset interpreter ("Killian" will be forgotten) interpreter.messages = messages # Resume chat from 'messages' ("Killian" will be remembered)
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)
Change your Language Model
Open Interpreter uses LiteLLM to connect to hosted language models.
You can change the model by setting the model parameter:
interpreter --model gpt-3.5-turbo interpreter --model claude-2 interpreter --model command-nightly
In Python, set the model on the object:
interpreter.model = "gpt-3.5-turbo"
Find the appropriate “model” string for your language model here.
Running Open Interpreter locally
Open Interpreter uses LM Studio to connect to local language models (experimental).
Simply run interpreter
in local mode from the command line:
You will need to run LM Studio in the background.
- Download https://lmstudio.ai/ then start it.
- Select a model then click ↓ Download.
- Click the
↔️ button on the left (below 💬). - Select your model at the top, then click Start Server.
Once the server is running, you can begin your conversation with Open Interpreter.
(When you run the command interpreter --local
, the steps above will be displayed.)
Note: Local mode sets your
context_window
to 3000, and yourmax_tokens
to 1000. If your model has different requirements, set these parameters manually (see below).
Context Window, Max Tokens
You can modify the max_tokens
and context_window
(in tokens) of locally running models.
For local mode, smaller context windows will use less RAM, so we recommend trying a much shorter window (~1000) if it’s is failing / if it’s slow. Make sure max_tokens
is less than context_window
.
interpreter --local --max_tokens 1000 --context_window 3000
Debug mode
To help contributors inspect Open Interpreter, --debug
mode is highly verbose.
You can activate debug mode by using it’s flag (interpreter --debug
), or mid-chat:
$ interpreter ... > %debug true <- Turns on debug mode > %debug false
->->