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

Requires new openai api support

Open yakumo96 opened this issue 2 years ago • 4 comments

Is your feature request related to a problem? Please describe.

With a newer version of the openai api, it doesn't work, the log looks like this

Using cached openai-1.3.1-py3-none-any.whl (220 kB) Installing collected packages: openai Attempting uninstall: openai Found existing installation: openai 0.28.1 Uninstalling openai-0.28.1: Successfully uninstalled openai-0.28.1 ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. litellm 0.13.2 requires openai<0.29.0,>=0.27.0, but you have openai 1.3.1 which is incompatible. open-interpreter 0.1.15 requires openai<0.29.0,>=0.28.0, but you have openai 1.3.1 which is incompatible. Successfully installed openai-1.3.1

yakumo:~$ interpreter --version Traceback (most recent call last): File "/home/yakumo/anaconda3/bin/interpreter", line 5, in from interpreter import cli File "/home/yakumo/anaconda3/lib/python3.11/site-packages/interpreter/init.py", line 3, in from .core.core import Interpreter File "/home/yakumo/anaconda3/lib/python3.11/site-packages/interpreter/core/core.py", line 10, in from ..cli.cli import cli File "/home/yakumo/anaconda3/lib/python3.11/site-packages/interpreter/cli/cli.py", line 8, in from ..terminal_interface.conversation_navigator import conversation_navigator File "/home/yakumo/anaconda3/lib/python3.11/site-packages/interpreter/terminal_interface/conversation_navigator.py", line 14, in from .render_past_conversation import render_past_conversation File "/home/yakumo/anaconda3/lib/python3.11/site-packages/interpreter/terminal_interface/render_past_conversation.py", line 4, in from .magic_commands import handle_magic_command File "/home/yakumo/anaconda3/lib/python3.11/site-packages/interpreter/terminal_interface/magic_commands.py", line 4, in from ..utils.count_tokens import count_messages_tokens File "/home/yakumo/anaconda3/lib/python3.11/site-packages/interpreter/utils/count_tokens.py", line 2, in from litellm import cost_per_token File "/home/yakumo/anaconda3/lib/python3.11/site-packages/litellm/init.py", line 332, in from .timeout import timeout File "/home/yakumo/anaconda3/lib/python3.11/site-packages/litellm/timeout.py", line 20, in from openai.error import Timeout ModuleNotFoundError: No module named 'openai.error'

Describe the solution you'd like

Hopefully there will be an update to support the new version, I think this is something that is very necessary

For example, version 1.3 added gpt-3.5-turbo-1106. https://github.com/openai/openai-python/releases

Describe alternatives you've considered

No response

Additional context

No response

yakumo96 avatar Nov 16 '23 18:11 yakumo96

This [openai v0.28.1] is required by litellm: https://github.com/BerriAI/litellm/blob/85932ac247343119719a857808d4398d63c085b2/poetry.lock#L637C7-L637C7

Here is the issue in litellm: https://github.com/BerriAI/litellm/issues/774

Notnaton avatar Nov 19 '23 10:11 Notnaton

According to the link you provided, I used the new version of litellm==v1.2 and openai==1.3.1, and the following is the log of the attempted run

Downloading litellm-1.2.0-py3-none-any.whl (1.4 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 16.0 MB/s eta 0:00:00 Installing collected packages: litellm Attempting uninstall: litellm Found existing installation: litellm 0.13.2 Uninstalling litellm-0.13.2: Successfully uninstalled litellm-0.13.2 ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. open-interpreter 0.1.15 requires litellm==0.13.2, but you have litellm 1.2.0 which is incompatible. open-interpreter 0.1.15 requires openai<0.29.0,>=0.28.0, but you have openai 1.3.1 which is incompatible. Successfully installed litellm-1.2.0

(base) yakumo@yakumo-intel:~$ interpreter --model gpt-3.5-turbo

Welcome to Open Interpreter.

───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

▌ OpenAI API key not found

To use GPT-4 (highly recommended) please provide an OpenAI API key.

To use another language model, consult the documentation at docs.openinterpreter.com.

───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

OpenAI API key: OpenAI API key: sk-W...vodG

Tip: To save this key for later, run export OPENAI_API_KEY=your_api_key on Mac/Linux or setx OPENAI_API_KEY your_api_key on Windows.

───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

▌ Model set to gpt-3.5-turbo

Open Interpreter will require approval before running code.

Use interpreter -y to bypass this.

Press CTRL-C to exit.

Create an empty file test.test

    Python Version: 3.11.4
    Pip Version: 23.2.1
    Open-interpreter Version: cmd:Interpreter, pkg: 0.1.15
    OS Version and Architecture: Linux-5.15.0-88-generic-x86_64-with-glibc2.35
    CPU Info: x86_64
    RAM Info: 62.64 GB, used: 1.20, free: 60.44
    

    Interpreter Info
    Vision: False
    Model: gpt-3.5-turbo
    Function calling: True
    Context window: None
    Max tokens: None

    Auto run: False
    API base: None
    Local: False

    Curl output: Not local

Traceback (most recent call last): File "/home/yakumo/anaconda3/lib/python3.11/site-packages/pydantic/main.py", line 753, in getattr return pydantic_extra[item] ~~~~~~~~~~~~~~^^^^^^ KeyError: 'items'

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/home/yakumo/anaconda3/bin/interpreter", line 8, in sys.exit(cli()) ^^^^^ File "/home/yakumo/anaconda3/lib/python3.11/site-packages/interpreter/core/core.py", line 24, in cli cli(self) File "/home/yakumo/anaconda3/lib/python3.11/site-packages/interpreter/cli/cli.py", line 268, in cli interpreter.chat() File "/home/yakumo/anaconda3/lib/python3.11/site-packages/interpreter/core/core.py", line 86, in chat for _ in self._streaming_chat(message=message, display=display): File "/home/yakumo/anaconda3/lib/python3.11/site-packages/interpreter/core/core.py", line 106, in _streaming_chat yield from terminal_interface(self, message) File "/home/yakumo/anaconda3/lib/python3.11/site-packages/interpreter/terminal_interface/terminal_interface.py", line 115, in terminal_interface for chunk in interpreter.chat(message, display=False, stream=True): File "/home/yakumo/anaconda3/lib/python3.11/site-packages/interpreter/core/core.py", line 127, in _streaming_chat yield from self._respond() File "/home/yakumo/anaconda3/lib/python3.11/site-packages/interpreter/core/core.py", line 162, in _respond yield from respond(self) File "/home/yakumo/anaconda3/lib/python3.11/site-packages/interpreter/core/respond.py", line 49, in respond for chunk in interpreter._llm(messages_for_llm): File "/home/yakumo/anaconda3/lib/python3.11/site-packages/interpreter/llm/setup_openai_coding_llm.py", line 131, in coding_llm accumulated_deltas = merge_deltas(accumulated_deltas, delta) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/yakumo/anaconda3/lib/python3.11/site-packages/interpreter/utils/merge_deltas.py", line 11, in merge_deltas for key, value in delta.items(): ^^^^^^^^^^^ File "/home/yakumo/anaconda3/lib/python3.11/site-packages/pydantic/main.py", line 755, in getattr raise AttributeError(f'{type(self).name!r} object has no attribute {item!r}') from exc AttributeError: 'Delta' object has no attribute 'items'

Actually the litellm v1.1.0 update has explicitly labeled Requires openai>=1.0.0 in the change log

https://github.com/BerriAI/litellm/releases

if using [openai v0.28.1] with litellm==1.2.0 doesn't work either, with the following results

(base) yakumo@yakumo-intel:~$ pip install openai==0.28.1

Collecting openai==0.28.1 Obtaining dependency information for openai==0.28.1 from https://files.pythonhosted.org/packages/1e/9f/385c25502f437686e4aa715969e5eaf5c2cb5e5ffa7c5cdd52f3c6ae967a/openai-0.28.1-py3-none-any.whl.metadata Using cached openai-0.28.1-py3-none-any.whl.metadata (11 kB) Requirement already satisfied: requests>=2.20 in ./anaconda3/lib/python3.11/site-packages (from openai==0.28.1) (2.31.0) Requirement already satisfied: tqdm in ./anaconda3/lib/python3.11/site-packages (from openai==0.28.1) (4.65.0) Requirement already satisfied: aiohttp in ./anaconda3/lib/python3.11/site-packages (from openai==0.28.1) (3.8.3) Requirement already satisfied: charset-normalizer<4,>=2 in ./anaconda3/lib/python3.11/site-packages (from requests>=2.20->openai==0.28.1) (2.0.4) Requirement already satisfied: idna<4,>=2.5 in ./anaconda3/lib/python3.11/site-packages (from requests>=2.20->openai==0.28.1) (3.4) Requirement already satisfied: urllib3<3,>=1.21.1 in ./anaconda3/lib/python3.11/site-packages (from requests>=2.20->openai==0.28.1) (1.26.16) Requirement already satisfied: certifi>=2017.4.17 in ./anaconda3/lib/python3.11/site-packages (from requests>=2.20->openai==0.28.1) (2023.7.22) Requirement already satisfied: attrs>=17.3.0 in ./anaconda3/lib/python3.11/site-packages (from aiohttp->openai==0.28.1) (22.1.0) Requirement already satisfied: multidict<7.0,>=4.5 in ./anaconda3/lib/python3.11/site-packages (from aiohttp->openai==0.28.1) (6.0.2) Requirement already satisfied: async-timeout<5.0,>=4.0.0a3 in ./anaconda3/lib/python3.11/site-packages (from aiohttp->openai==0.28.1) (4.0.2) Requirement already satisfied: yarl<2.0,>=1.0 in ./anaconda3/lib/python3.11/site-packages (from aiohttp->openai==0.28.1) (1.8.1) Requirement already satisfied: frozenlist>=1.1.1 in ./anaconda3/lib/python3.11/site-packages (from aiohttp->openai==0.28.1) (1.3.3) Requirement already satisfied: aiosignal>=1.1.2 in ./anaconda3/lib/python3.11/site-packages (from aiohttp->openai==0.28.1) (1.2.0) Using cached openai-0.28.1-py3-none-any.whl (76 kB) Installing collected packages: openai Attempting uninstall: openai Found existing installation: openai 1.3.1 Uninstalling openai-1.3.1: Successfully uninstalled openai-1.3.1 ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. open-interpreter 0.1.15 requires litellm==0.13.2, but you have litellm 1.2.0 which is incompatible. litellm 1.2.0 requires openai>=1.0.0, but you have openai 0.28.1 which is incompatible. Successfully installed openai-0.28.1

(base) yakumo@yakumo-intel:~$ interpreter --model gpt-3.5-turbo

Traceback (most recent call last): File "/home/yakumo/anaconda3/bin/interpreter", line 5, in from interpreter import cli File "/home/yakumo/anaconda3/lib/python3.11/site-packages/interpreter/init.py", line 3, in from .core.core import Interpreter File "/home/yakumo/anaconda3/lib/python3.11/site-packages/interpreter/core/core.py", line 10, in from ..cli.cli import cli File "/home/yakumo/anaconda3/lib/python3.11/site-packages/interpreter/cli/cli.py", line 8, in from ..terminal_interface.conversation_navigator import conversation_navigator File "/home/yakumo/anaconda3/lib/python3.11/site-packages/interpreter/terminal_interface/conversation_navigator.py", line 14, in from .render_past_conversation import render_past_conversation File "/home/yakumo/anaconda3/lib/python3.11/site-packages/interpreter/terminal_interface/render_past_conversation.py", line 4, in from .magic_commands import handle_magic_command File "/home/yakumo/anaconda3/lib/python3.11/site-packages/interpreter/terminal_interface/magic_commands.py", line 4, in from ..utils.count_tokens import count_messages_tokens File "/home/yakumo/anaconda3/lib/python3.11/site-packages/interpreter/utils/count_tokens.py", line 2, in from litellm import cost_per_token File "/home/yakumo/anaconda3/lib/python3.11/site-packages/litellm/init.py", line 335, in from .timeout import timeout File "/home/yakumo/anaconda3/lib/python3.11/site-packages/litellm/timeout.py", line 20, in from litellm.exceptions import Timeout File "/home/yakumo/anaconda3/lib/python3.11/site-packages/litellm/exceptions.py", line 12, in from openai import ( ImportError: cannot import name 'AuthenticationError' from 'openai' (/home/yakumo/anaconda3/lib/python3.11/site-packages/openai/init.py)

In fact, litellm has already updated its support for the new openai api, so maybe the interpreter needs to be updated accordingly.

yakumo96 avatar Nov 21 '23 05:11 yakumo96

I'm bumping this.

I’m encountering a version conflict with the openai package after upgrading aider. I use these two tools together as my go-to's. The aider-chat tool requires openai version 1.3.7, but the upgrade for open-interpreter installs version 0.28.1, which is incompatible with aider-chat.

Error Message: ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. aider-chat 0.19.0 requires openai==1.3.7, but you have openai 0.28.1 which is incompatible.

#793 indicates the requirement was changed to openai>=1.0.0 but upgrading (pip install --upgrade open-interpreter) still requires 0.28.1.

Thank you for your assistance!

transcendr avatar Dec 21 '23 16:12 transcendr

It would be great if the latest openai libraries could be supported. Most of the other libraries like Llama Index and Langchain support the latest

gltanaka avatar Dec 24 '23 22:12 gltanaka

Closing this stale issue. Please create a new issue if the problem is not resolved or explained in the documentation. Thanks!

MikeBirdTech avatar Mar 18 '24 20:03 MikeBirdTech