Skip to content

Commit

Permalink
The New Computer Update (better for developers, i is here)
Browse files Browse the repository at this point in the history
  • Loading branch information
KillianLucas committed Dec 27, 2023
1 parent bc21da8 commit dda19b7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 17 deletions.
13 changes: 2 additions & 11 deletions interpreter/__init__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
import sys
from .core.core import Interpreter
from .core.core import OpenInterpreter

sys.modules["interpreter"] = Interpreter()

# ^ This is done so when users `import interpreter`,
# they get an instance.

# **This is a controversial thing to do,**
# because perhaps modules ought to behave like modules.

# But I think it saves a step, removes friction, and looks good.
interpreter = OpenInterpreter()

# ____ ____ __ __
# / __ \____ ___ ____ / _/___ / /____ _________ ________ / /____ _____
Expand Down
5 changes: 1 addition & 4 deletions interpreter/core/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from .utils.truncate_output import truncate_output


class Interpreter:
class OpenInterpreter:
def start_terminal_interface(self):
start_terminal_interface(self)

Expand Down Expand Up @@ -50,9 +50,6 @@ def __init__(self):
self.os = False
self.speak_messages = False

# Expose class so people can make new instances
self.Interpreter = Interpreter

# LLM
self.llm = Llm(self)

Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.scripts]
interpreter = "interpreter:start_terminal_interface"
interpreter = "interpreter:interpreter.start_terminal_interface"
i = "interpreter:interpreter.start_terminal_interface"

[tool.black]
target-version = ['py311']
Expand Down
6 changes: 5 additions & 1 deletion tests/test_interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@

import pytest

import interpreter
#####
from interpreter import OpenInterpreter
from interpreter.terminal_interface.utils.apply_config import apply_config
from interpreter.terminal_interface.utils.count_tokens import (
count_messages_tokens,
count_tokens,
)

interpreter = OpenInterpreter()
#####


@pytest.mark.skip(reason="Computer with display only + no way to fail test")
def test_get_selected_text():
Expand Down

0 comments on commit dda19b7

Please sign in to comment.