Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught AttributeError in sendchat.py line 30 #3301

Closed
gitkola opened this issue Feb 19, 2025 · 1 comment
Closed

Uncaught AttributeError in sendchat.py line 30 #3301

gitkola opened this issue Feb 19, 2025 · 1 comment

Comments

@gitkola
Copy link

gitkola commented Feb 19, 2025

Aider version: 0.57.1
Python version: 3.12.8
Platform: macOS-15.2-x86_64-i386-64bit
Python implementation: CPython
Virtual environment: Yes
OS: Darwin 24.2.0 (64bit)
Git version: git version 2.46.2

An uncaught exception occurred:

Traceback (most recent call last):
  File "openai.py", line 711, in completion
    raise e
  File "openai.py", line 595, in completion
    return self.streaming(
           ^^^^^^^^^^^^^^^
  File "openai.py", line 844, in streaming
    openai_client: OpenAI = self._get_openai_client(  # type: ignore
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "openai.py", line 368, in _get_openai_client
    _new_client = OpenAI(
                  ^^^^^^^
  File "_client.py", line 110, in __init__
    raise OpenAIError(
openai.OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 1721, in completion
    raise e
  File "main.py", line 1694, in completion
    response = openai_chat_completions.completion(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "openai.py", line 721, in completion
    raise OpenAIError(
litellm.llms.openai.common_utils.OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "base_coder.py", line 1115, in send_message
    "I switched to a new code base. Please don't consider the above files"
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "base_coder.py", line 1392, in send
    self.show_exhausted_error()
                              ^
  File "sendchat.py", line 87, in send_completion
  File "utils.py", line 1154, in wrapper
    raise e
  File "utils.py", line 1032, in wrapper
    result = original_function(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "main.py", line 3085, in completion
    raise exception_type(
          ^^^^^^^^^^^^^^^
  File "exception_mapping_utils.py", line 2201, in exception_type
    raise e
  File "exception_mapping_utils.py", line 357, in exception_type
    raise AuthenticationError(
litellm.exceptions.AuthenticationError: litellm.AuthenticationError: AuthenticationError: OpenAIException - The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "aider", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "main.py", line 709, in main
    if args.check_update:
            ^^^^^^^^^^^
  File "base_coder.py", line 723, in run
  File "base_coder.py", line 766, in run_one
    )
      
  File "base_coder.py", line 1117, in send_message
    ),
  File "sendchat.py", line 30, in retry_exceptions
    """Ensure messages alternate between 'assistant' and 'user' roles.
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'litellm.llms.anthropic.chat' has no attribute 'AnthropicError'

Copy link

Thanks for trying aider and filing this issue.

This looks like a duplicate of #1414. Please see the comments there for more information, and feel free to continue the discussion within that issue.

I'm going to close this issue for now. But please let me know if you think this is actually a distinct issue and I will reopen this issue.

Note: A bot script made these updates to the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant