Skip to content

An error occurred while using the third-party API for drawing. When you see "Viewing image..., to use local vision, run `pip install 'open-interpreter[local]' ". After this, the application crashes. #1366

@Raintimewang

Description

@Raintimewang

Describe the bug

Draw a sine function

Plan:

1 Import necessary libraries in Python.
2 Generate x values.
3 Calculate corresponding y values using the sin function.
4 Plot the graph.

import numpy as np
import matplotlib.pyplot as plt

x = np.linspace(0, 2*np.pi, 1000)
y = np.sin(x)

plt.plot(x, y)
plt.xlabel('x')
plt.ylabel('sin(x)')
plt.title('Sine Function')
plt.show()

Viewing image...

To use local vision, run pip install 'open-interpreter[local]'.

To use local vision, run pip install 'open-interpreter[local]'.

Traceback (most recent call last):
File "D:\Anaconda\Lib\site-packages\litellm\llms\openai.py", line 736, in completion
raise e
File "D:\Anaconda\Lib\site-packages\litellm\llms\openai.py", line 655, in completion
return self.streaming(
^^^^^^^^^^^^^^^
File "D:\Anaconda\Lib\site-packages\litellm\llms\openai.py", line 833, in streaming
response = openai_client.chat.completions.create(**data, timeout=timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Anaconda\Lib\site-packages\openai_utils_utils.py", line 277, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "D:\Anaconda\Lib\site-packages\openai\resources\chat\completions.py", line 646, in create
return self._post(
^^^^^^^^^^^
File "D:\Anaconda\Lib\site-packages\openai_base_client.py", line 1266, in post
return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Anaconda\Lib\site-packages\openai_base_client.py", line 942, in request
return self._request(
^^^^^^^^^^^^^^
File "D:\Anaconda\Lib\site-packages\openai_base_client.py", line 1046, in _request
raise self._make_status_error_from_response(err.response) from None
openai.AuthenticationError: Error code: 401 - {'error': {'code': 'AuthenticationError', 'message': 'The API key or AK/SK
in the request is missing or invalid. requestId: XXXXX', 'param': '',
'type': 'Unauthorized'}}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\Anaconda\Lib\site-packages\litellm\main.py", line 1112, in completion
raise e
File "D:\Anaconda\Lib\site-packages\litellm\main.py", line 1085, in completion
response = openai_chat_completions.completion(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Anaconda\Lib\site-packages\litellm\llms\openai.py", line 742, in completion
raise OpenAIError(status_code=e.status_code, message=str(e))
litellm.llms.openai.OpenAIError: Error code: 401 - {'error': {'code': 'AuthenticationError', 'message': 'The API key or
AK/SK in the request is missing or invalid. requestId: XXXXX', 'param':
'', 'type': 'Unauthorized'}}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\Anaconda\Lib\site-packages\interpreter\core\llm\llm.py", line 386, in fixed_litellm_completions
yield from litellm.completion(**params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Anaconda\Lib\site-packages\litellm\utils.py", line 3472, in wrapper
raise e
File "D:\Anaconda\Lib\site-packages\litellm\utils.py", line 3363, in wrapper
result = original_function(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Anaconda\Lib\site-packages\litellm\main.py", line 2480, in completion
raise exception_type(
^^^^^^^^^^^^^^^
File "D:\Anaconda\Lib\site-packages\litellm\utils.py", line 9927, in exception_type
raise e
File "D:\Anaconda\Lib\site-packages\litellm\utils.py", line 8500, in exception_type
raise AuthenticationError(
litellm.exceptions.AuthenticationError: AuthenticationError: OpenAIException - Error code: 401 - {'error': {'code':
'AuthenticationError', 'message': 'The API key or AK/SK in the request is missing or invalid. requestId:
021722153547363bc6ef51f61ecfafe48ca0f0d9537b76766796a', 'param': '', 'type': 'Unauthorized'}}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in run_code
File "D:\Anaconda\Scripts\interpreter.exe_main
.py", line 7, in
File "D:\Anaconda\Lib\site-packages\interpreter\terminal_interface\start_terminal_interface.py", line 525, in main
start_terminal_interface(interpreter)
File "D:\Anaconda\Lib\site-packages\interpreter\terminal_interface\start_terminal_interface.py", line 491, in
start_terminal_interface
interpreter.chat()
File "D:\Anaconda\Lib\site-packages\interpreter\core\core.py", line 188, in chat
for _ in self._streaming_chat(message=message, display=display):
File "D:\Anaconda\Lib\site-packages\interpreter\core\core.py", line 220, in _streaming_chat
yield from terminal_interface(self, message)
File "D:\Anaconda\Lib\site-packages\interpreter\terminal_interface\terminal_interface.py", line 140, in
terminal_interface
for chunk in interpreter.chat(message, display=False, stream=True):
File "D:\Anaconda\Lib\site-packages\interpreter\core\core.py", line 259, in _streaming_chat
yield from self._respond_and_store()
File "D:\Anaconda\Lib\site-packages\interpreter\core\core.py", line 310, in _respond_and_store
for chunk in respond(self):
File "D:\Anaconda\Lib\site-packages\interpreter\core\respond.py", line 79, in respond
for chunk in interpreter.llm.run(messages_for_llm):
File "D:\Anaconda\Lib\site-packages\interpreter\core\llm\llm.py", line 277, in run
yield from run_text_llm(self, params)
File "D:\Anaconda\Lib\site-packages\interpreter\core\llm\run_text_llm.py", line 20, in run_text_llm
for chunk in llm.completions(**params):
File "D:\Anaconda\Lib\site-packages\interpreter\core\llm\llm.py", line 389, in fixed_litellm_completions
raise first_error
File "D:\Anaconda\Lib\site-packages\interpreter\core\llm\llm.py", line 370, in fixed_litellm_completions
yield from litellm.completion(**params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Anaconda\Lib\site-packages\litellm\utils.py", line 3472, in wrapper
raise e
File "D:\Anaconda\Lib\site-packages\litellm\utils.py", line 3363, in wrapper
result = original_function(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Anaconda\Lib\site-packages\litellm\main.py", line 2480, in completion
raise exception_type(
^^^^^^^^^^^^^^^
File "D:\Anaconda\Lib\site-packages\litellm\utils.py", line 9927, in exception_type
raise e
File "D:\Anaconda\Lib\site-packages\litellm\utils.py", line 8491, in exception_type
raise BadRequestError(
litellm.exceptions.BadRequestError: OpenAIException - Error code: 400 - {'error': {'code': 'InvalidParameter',
'message': 'One or more parameters specified in the request are not valid. Request id:
XXXXX', 'param': 'messages.role', 'type': 'BadRequest'}}

Reproduce

Draw a sine function

Expected behavior

Continue the conversation instead of exiting

Screenshots

image

Open Interpreter version

0.3.4

Python version

3.12.4

Operating System name and version

win11

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions