open-interpreter icon indicating copy to clipboard operation
open-interpreter copied to clipboard

Cant run scripts

Open Fschoeller opened this issue 1 year ago • 6 comments

Describe the bug

When given a simple task such as executing a hello world script, an exception is raised:

Python Version: 3.10.12 Pip Version: 22.0.2 Open-interpreter Version: cmd:Interpreter, pkg: 0.2.0 OS Version and Architecture: Linux-5.15.133.1-microsoft-standard-WSL2-x86_64-with-glibc2.35 CPU Info: x86_64 RAM Info: 7.62 GB, used: 0.70, free: 5.72

    # Interpreter Info

    Vision: False
    Model: azure/GPT3
    Function calling: True
    Context window: None
    Max tokens: None

    Auto run: False
    API base: None
    Offline: False

    Curl output: Not local

    # Messages

    System Message: You are Open Interpreter, a world-class programmer that can complete any goal by executing code.

First, write a plan. Always recap the plan between each code block (you have extreme short-term memory loss, so you need to recap the plan between each message block to retain it). When you execute code, it will be executed on the user's machine. The user has given you full and complete permission to execute any code necessary to complete the task. Execute the code. If you want to send data between programming languages, save the data to a txt or json. You can access the internet. Run any code to achieve the goal, and if at first you don't succeed, try again and again. You can install new packages. When a user refers to a filename, they're likely referring to an existing file in the directory you're currently executing code in. Write messages to the user in Markdown. In general, try to make plans with as few steps as possible. As for actually executing code to carry out that plan, for stateful languages (like python, javascript, shell, but NOT for html which starts from 0 every time) it's critical not to try to do everything in one code block. You should try something, print information about it, then continue from there in tiny, informed steps. You will never get it on the first try, and attempting it in one go will often lead to errors you cant see. You are capable of any task.

    {'role': 'user', 'type': 'message', 'content': 'python script for hello world'}

{'role': 'assistant', 'type': 'message', 'content': 'Sure! Here is a Python script that prints "Hello, World!":\n\npython\nprint("Hello, World!")\n\n\nDo you want me to execute this script?'}

{'role': 'user', 'type': 'message', 'content': 'yes'}

Traceback (most recent call last): File "/usr/local/bin/interpreter", line 8, in sys.exit(interpreter.start_terminal_interface()) File "/usr/local/lib/python3.10/dist-packages/interpreter/core/core.py", line 25, in start_terminal_interface start_terminal_interface(self) File "/usr/local/lib/python3.10/dist-packages/interpreter/terminal_interface/start_terminal_interface.py", line 684, in start_terminal_interface interpreter.chat() File "/usr/local/lib/python3.10/dist-packages/interpreter/core/core.py", line 86, in chat for _ in self._streaming_chat(message=message, display=display): File "/usr/local/lib/python3.10/dist-packages/interpreter/core/core.py", line 113, in _streaming_chat yield from terminal_interface(self, message) File "/usr/local/lib/python3.10/dist-packages/interpreter/terminal_interface/terminal_interface.py", line 135, in terminal_interface for chunk in interpreter.chat(message, display=False, stream=True): File "/usr/local/lib/python3.10/dist-packages/interpreter/core/core.py", line 148, in _streaming_chat yield from self._respond_and_store() File "/usr/local/lib/python3.10/dist-packages/interpreter/core/core.py", line 194, in _respond_and_store for chunk in respond(self): File "/usr/local/lib/python3.10/dist-packages/interpreter/core/respond.py", line 49, in respond for chunk in interpreter.llm.run(messages_for_llm): File "/usr/local/lib/python3.10/dist-packages/interpreter/core/llm/llm.py", line 191, in run yield from run_function_calling_llm(self, params) File "/usr/local/lib/python3.10/dist-packages/interpreter/core/llm/run_function_calling_llm.py", line 106, in run_function_calling_llm code_delta = accumulated_deltas["function_call"]["arguments"][ TypeError: 'NoneType' object is not subscriptable

Reproduce

interpreter --model azure/GPT3

python script for hello world

Expected behavior

That the script runs

Screenshots

No response

Open Interpreter version

0.2.0

Python version

3.10

Operating System name and version

WSL

Additional context

No response

Fschoeller avatar Jan 10 '24 12:01 Fschoeller

image https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models#gpt-35-turbo-model-availability

interpreter --model azure/GPT3

you should probably use interpreter --model azure/gpt-35-turbo I haven't used azure myself

Notnaton avatar Jan 12 '24 20:01 Notnaton

Unfortunately, that is not the issue, the model should be deployment name e.g interpreter --model azure/<DEPLOYMENT_NAME> it works fine as long as it does not have to run anything. Stuff like "write a joke" is no problem, so the model is correct.

Fschoeller avatar Jan 13 '24 09:01 Fschoeller

I see, this is a issue with merge_delta.py will make a fix soon

Notnaton avatar Jan 13 '24 10:01 Notnaton

I have the same problem.It is likely the version of your deployment doesn't support function-calling. I have made a pull request to enable passing an argument --no-llm_supports_functions whick will make OP to treat function_calls correctlly. Before this problem is fixed, you can manually set it to fmake it work for you for now. Open ""/usr/local/lib/python3.10/dist-packages/interpreter/core/llm/llm.py"" Find line 30, change from self.supports_functions = None to self.supports_functions = False

MonsterCoder avatar Jan 15 '24 16:01 MonsterCoder

Not sure if it has to do with function calling support. I tried with gpt4 turbo and it was the same result.

Fschoeller avatar Jan 17 '24 12:01 Fschoeller

@Fschoeller there is also a bug in the merge_delta function which throws error when merging a None function_calls.argument. function_call_result

MonsterCoder avatar Jan 17 '24 21:01 MonsterCoder

Has this bug been fixed? I met with the same issue, None type error.

cliffsofthestream avatar Jan 30 '24 07:01 cliffsofthestream

If you install from github and not pip it seems to work

Fschoeller avatar Jan 31 '24 09:01 Fschoeller

Should be fixed next update or if you install from the github as @Fschoeller said

Notnaton avatar Jan 31 '24 11:01 Notnaton