OpenInterpreter / open-interpreter

A natural language interface for computers
http://openinterpreter.com/
GNU Affero General Public License v3.0
55.66k stars 4.83k forks source link

anthropic.BadRequestError #1509

Open austinmw opened 3 weeks ago

austinmw commented 3 weeks ago

Describe the bug

interpreter --os screenshots are too large without resizing

{"action": "screenshot"}Traceback (most recent call last):
  File "/Users/austinwelch/mambaforge/envs/py312/bin/interpreter", line 5, in <module>
    from interpreter.terminal_interface.start_terminal_interface import main
  File "/Users/austinwelch/mambaforge/envs/py312/lib/python3.12/site-packages/interpreter/__init__.py", line 54, in <module>
    run_async_main()
  File "/Users/austinwelch/mambaforge/envs/py312/lib/python3.12/site-packages/interpreter/computer_use/loop.py", line 528, in run_async_main
    asyncio.run(main())
  File "/Users/austinwelch/mambaforge/envs/py312/lib/python3.12/asyncio/runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/Users/austinwelch/mambaforge/envs/py312/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/austinwelch/mambaforge/envs/py312/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/Users/austinwelch/mambaforge/envs/py312/lib/python3.12/site-packages/interpreter/computer_use/loop.py", line 505, in main
    async for chunk in sampling_loop(
  File "/Users/austinwelch/mambaforge/envs/py312/lib/python3.12/site-packages/interpreter/computer_use/loop.py", line 152, in sampling_loop
    raw_response = client.beta.messages.create(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/austinwelch/mambaforge/envs/py312/lib/python3.12/site-packages/anthropic/_utils/_utils.py", line 274, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/austinwelch/mambaforge/envs/py312/lib/python3.12/site-packages/anthropic/resources/beta/messages/messages.py", line 896, in create
    return self._post(
           ^^^^^^^^^^^
  File "/Users/austinwelch/mambaforge/envs/py312/lib/python3.12/site-packages/anthropic/_base_client.py", line 1277, in post
    return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/austinwelch/mambaforge/envs/py312/lib/python3.12/site-packages/anthropic/_base_client.py", line 954, in request
    return self._request(
           ^^^^^^^^^^^^^^
  File "/Users/austinwelch/mambaforge/envs/py312/lib/python3.12/site-packages/anthropic/_base_client.py", line 1058, in _request
    raise self._make_status_error_from_response(err.response) from None
anthropic.BadRequestError: Error code: 400 - {'type': 'error', 'error': {'type': 'invalid_request_error', 'message': 'messages.2.content.0.tool_result.content.0.image.source.base64: image exceeds 5 MB maximum: 5626164 bytes > 5242880 bytes'}}

Reproduce

interpreter --os on large monitor

Expected behavior

No error

Screenshots

No response

Open Interpreter version

0.4.3

Python version

3.12

Operating System name and version

MacOS 15

Additional context

No response

MikeBirdTech commented 2 weeks ago

Need to figure out a way to limit the size of screenshots without impacting coordinate system