Skip to content

Commit 0224cf9

Browse files
authored
Merge branch 'OpenInterpreter:main' into py-alias
2 parents 1676ddc + 3e95571 commit 0224cf9

File tree

7 files changed

+1334
-1310
lines changed

7 files changed

+1334
-1310
lines changed

interpreter/core/computer/computer.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from .contacts.contacts import Contacts
88
from .display.display import Display
99
from .docs.docs import Docs
10+
from .files.files import Files
1011
from .keyboard.keyboard import Keyboard
1112
from .mail.mail import Mail
1213
from .mouse.mouse import Mouse
@@ -39,12 +40,13 @@ def __init__(self, interpreter):
3940
self.skills = Skills(self)
4041
self.docs = Docs(self)
4142
self.ai = Ai(self)
43+
self.files = Files(self)
4244

4345
self.emit_images = True
4446
self.api_base = "https://api.openinterpreter.com/v0"
4547
self.save_skills = True
4648

47-
self.import_computer_api = True
49+
self.import_computer_api = False # Defaults to false
4850
self._has_imported_computer_api = False # Because we only want to do this once
4951

5052
# Shortcut for computer.terminal.languages

interpreter/core/computer/skills/skills.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def import_skills(self):
4949

5050
output = self.computer.run("python", code_to_run)
5151

52-
if "traceback" in output.lower():
52+
if type(output) == str and "traceback" in output.lower():
5353
# Import them individually
5454
for file in glob.glob(os.path.join(self.path, "*.py")):
5555
with open(file, "r") as f:
@@ -60,7 +60,7 @@ def import_skills(self):
6060

6161
output = self.computer.run("python", code_to_run)
6262

63-
if "traceback" in output.lower():
63+
if type(output) == str and "traceback" in output.lower():
6464
print(
6565
f"Skill at {file} might be broken— it produces a traceback when run."
6666
)

interpreter/core/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def __init__(
6969
custom_instructions="",
7070
computer=None,
7171
sync_computer=True,
72-
import_computer_api=True,
72+
import_computer_api=False,
7373
skills_path=None,
7474
import_skills=True,
7575
multi_line=False,

interpreter/core/llm/utils/convert_to_openai_messages.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ def convert_to_openai_messages(
170170
else:
171171
raise Exception(f"Unable to convert this message type: {message}")
172172

173-
new_message["content"] = new_message["content"].strip()
173+
if isinstance(new_message["content"], str):
174+
new_message["content"] = new_message["content"].strip()
174175

175176
new_messages.append(new_message)
176177

interpreter/terminal_interface/start_terminal_interface.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -357,15 +357,15 @@ def start_terminal_interface(interpreter):
357357

358358
### Set some helpful settings we know are likely to be true
359359

360-
if interpreter.llm.model == "gpt-4-1106-preview":
360+
if interpreter.llm.model.startswith("gpt-4") or interpreter.llm.model.startswith("openai/gpt-4"):
361361
if interpreter.llm.context_window is None:
362362
interpreter.llm.context_window = 128000
363363
if interpreter.llm.max_tokens is None:
364364
interpreter.llm.max_tokens = 4096
365365
if interpreter.llm.supports_functions is None:
366-
interpreter.llm.supports_functions = True
366+
interpreter.llm.supports_functions = False if "vision" in interpreter.llm.model else True
367367

368-
if interpreter.llm.model == "gpt-3.5-turbo-1106":
368+
if interpreter.llm.model.startswith("gpt-3.5-turbo") or interpreter.llm.model.startswith("openai/gpt-3.5-turbo"):
369369
if interpreter.llm.context_window is None:
370370
interpreter.llm.context_window = 16000
371371
if interpreter.llm.max_tokens is None:
@@ -432,7 +432,7 @@ def set_attributes(args, arguments):
432432

433433

434434
def main():
435-
interpreter = OpenInterpreter()
435+
interpreter = OpenInterpreter(import_computer_api=True)
436436
try:
437437
start_terminal_interface(interpreter)
438438
except KeyboardInterrupt:

0 commit comments

Comments
 (0)