Skip to main content

Open Interpreter

A minimal, open-source implementation of OpenAI's code interpreter.

Interpreter Demo

pip install open-interpreter
interpreter

What is this?


Having access to a junior programmer working at the speed of your fingertips ... can make new workflows effortless and efficient, as well as open the benefits of programming to new audiences.

OpenAI's Code Interpreter Release


Open Interpreter lets GPT-4 run Python code 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 Python's general-purpose capabilities:

  • Create and edit photos, videos, PDFs, etc.
  • Run selenium to control a Chrome browser.
  • Modify files/folders on your local system.
  • ...etc.

⚠️ Note: You'll be asked to approve any code before it's run.


How does this compare to OpenAI's code interpreter?

Demos

Open In Colab

https://github.com/KillianLucas/open-interpreter/assets/63927363/bfd31800-3587-4d8e-91ac-195482860633

Features

  • Generated code runs locally (with confirmation).
  • Interactive, streaming chat inside your terminal.
  • Uses pip and apt-get to extend itself.

Quick Start

pip install open-interpreter

Terminal

After installation, set your OPENAI_API_KEY environment variable, then simply run interpreter:

interpreter

Python

import interpreter

interpreter.api_key = "your_openai_api_key"
interpreter.chat() # Starts an interactive chat

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.

This combines the power of GPT-4's Code Interpreter with the flexibility of your local development environment.

Commands

Interactive Chat

To start an interactive chat in your terminal, either run interpreter from the command line:

interpreter

Or interpreter.chat() from a .py file:

interpreter.chat()

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:

interpreter.reset()

Save and Restore Chats

interpreter.chat() returns a List of messages when return_messages=True, which can be used to resume a conversation with interpreter.load(messages):

messages = interpreter.chat("My name is Killian.", return_messages=True) # Save messages to 'messages'
interpreter.reset() # Reset interpreter ("Killian" will be forgotten)

interpreter.load(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)

Safety Notice

Since generated code is executed in your local environment, it can interact with your files and system settings, potentially leading to unexpected outcomes like data loss or security risks.

⚠️ Open Interpreter will ask for user confirmation before executing code.

You can run interpreter -y or set interpreter.auto_run = True to bypass this confirmation, in which case:

  • Be cautious when requesting commands that modify files or system settings.
  • Watch Open Interpreter like a self-driving car, and be prepared to end the process by closing your terminal.
  • Consider running Open Interpreter in a restricted environment like Google Colab or Replit. These environments are more isolated, reducing the risks associated with executing arbitrary code.

Open Interpreter also respects interpreter.forbidden_commands, a list of potentially harmful commands that are disallowed by default.

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.

Banner Image

Illustration by Open Interpreter. Inspired by Ruby Chen's GPT-4 artwork.

Release files for open-interpreter 0.0.255

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for open-interpreter 0.0.255
File Size Uploaded
open_interpreter-0.0.255.tar.gz 17.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for open-interpreter 0.0.255
File Interpreter ABI Platform
open_interpreter-0.0.255-py3-none-any.whl Python 3 none any Details

Total release size: 35.5 kB

Release files / open_interpreter-0.0.255.tar.gz

Download URL open_interpreter-0.0.255.tar.gz
Size 17.4 kB
Tags Source
SHA-256 checksum
How to use checksums
56376e8c2abbc3c60af6d2d8b30c0fa7e97477df7fb39a923111c0e614fdb01b
BLAKE2b-256 checksum
How to use checksums
1cab70e5817af8d16086a8c74662201ef76dc786d31822789f557fce466c3e7a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.10.8 Linux/5.19.0-1030-gcp

Release files / open_interpreter-0.0.255-py3-none-any.whl

Download URL open_interpreter-0.0.255-py3-none-any.whl
Size 18.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
505253b60f402fa2719185fc7077607994b0c33365554618ac98c78fc77c1753
BLAKE2b-256 checksum
How to use checksums
4df83ecce62a6039eaaa0a889ea7b737eb1968685cd0c9f3be83576b08b1eee0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.10.8 Linux/5.19.0-1030-gcp

Release history Release notifications | RSS feed

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.14

2 release files

0.3.13

2 release files

0.3.10

2 release files

0.3.9

2 release files

0.3.8

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.18

2 release files

0.1.16

2 release files

0.1.15

2 release files

0.1.14

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

This release

0.0.255 This release

2 release files

0.0.22

2 release files

0.0.21

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page