paul-gauthier / aider

aider is AI pair programming in your terminal
https://aider.chat/
Apache License 2.0
18.57k stars 1.72k forks source link

Uncaught AttributeError in sendchat.py line 30 #1519

Open denis-convious opened 5 days ago

denis-convious commented 5 days ago

Aider version: 0.56.0 Python version: 3.11.9 Platform: Linux-5.14.0-1057-oem-x86_64-with-glibc2.39 Python implementation: CPython Virtual environment: No OS: Linux 5.14.0-1057-oem (64bit) Git version: git version 2.46.0

An uncaught exception occurred:

Traceback (most recent call last):
  File "utils.py", line 10017, in __next__
    chunk = next(self.completion_stream)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "_streaming.py", line 43, in __next__
    return self._iterator.__next__()
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "_streaming.py", line 72, in __stream__
    raise APIError(
openai.APIError: {
  "error": {
    "message": "The model produced invalid content. Consider modifying your prompt if you are seeing this error persistently.",
    "type": "model_error",
    "param": null,
    "code": null
  }
}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "base_coder.py", line 1124, in send_message
    yield from self.send(messages, functions=self.functions)
  File "base_coder.py", line 1408, in send
    yield from self.show_send_output_stream(completion)
  File "base_coder.py", line 1482, in show_send_output_stream
    for chunk in completion:
  File "utils.py", line 10105, in __next__
    raise exception_type(
          ^^^^^^^^^^^^^^^
  File "utils.py", line 8194, in exception_type
    raise e  # it's already mapped
    ^^^^^^^
  File "utils.py", line 6594, in exception_type
    raise APIConnectionError(
litellm.exceptions.APIConnectionError: litellm.APIConnectionError: APIConnectionError: OpenAIException - {
  "error": {
    "message": "The model produced invalid content. Consider modifying your prompt if you are seeing this error persistently.",
    "type": "model_error",
    "param": null,
    "code": null
  }
}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File ".aider-wrapped", line 9, in <module>
    sys.exit(main())
             ^^^^^^
  File "main.py", line 698, in main
    coder.run()
  File "base_coder.py", line 735, in run
    self.run_one(user_message, preproc)
  File "base_coder.py", line 772, in run_one
    message = self.preproc_user_input(user_message)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "base_coder.py", line 761, in preproc_user_input
    return self.commands.run(inp)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "commands.py", line 221, in run
    return self.do_run(matching_commands[0][1:], rest_inp)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "commands.py", line 196, in do_run
    return cmd_method(args)
           ^^^^^^^^^^^^^^^^
  File "commands.py", line 947, in cmd_code
    return self._generic_chat_command(args, self.coder.main_model.edit_format)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "commands.py", line 964, in _generic_chat_command
    coder.run(user_msg)
  File "base_coder.py", line 729, in run
    self.run_one(with_message, preproc)
  File "base_coder.py", line 778, in run_one
    list(self.send_message(message))
  File "base_coder.py", line 1126, in send_message
    except retry_exceptions() as err:
           ^^^^^^^^^^^^^^^^^^
  File "sendchat.py", line 30, in retry_exceptions
    litellm.llms.anthropic.AnthropicError,
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'litellm.llms.anthropic' has no attribute 'AnthropicError'
fry69 commented 5 days ago

Thank you for filing this issue.

Please install aider separately from all other Python modules, as it needs specific versions. At best use pipx to let it manage the aidervenv for you.

The error you see comes from the fact that you installed a newer LiteLLM version than aider support (currently 1.44.7).