gravelBridge / AutoGPT-BingAI

An AutoGPT plugin to enable Bing AI in AutoGPT.
MIT License
174 stars 32 forks source link

Unexpected Keyword Argument Error #12

Open stevielbaby opened 1 year ago

stevielbaby commented 1 year ago

Problem:

The problem stemmed from a mismatch between the argument expected by the Chatbot class constructor in the BingAI Python module and the argument that was being passed to it. The error message pointed to this:

TypeError: Chatbot.__init__() got an unexpected keyword argument 'cookie_path'

This error indicates that the Chatbot class's __init__ method was being called with an argument (cookie_path) that it doesn't support.

Solution:

The solution was to change the Chatbot class's constructor to accept the cookie_path argument. Specifically, we added the following to the Chatbot class's __init__ method:

def __init__(
    self,
    proxy: str | None = None,
    cookies: list[dict] | None = None,
    cookie_path: str | None = None
) -> None:

This allows the Chatbot class to accept a cookie_path argument when it's instantiated.

Also, we adjusted the rest of the class to handle the new cookie_path argument appropriately. In this case, we didn't actually use cookie_path within the class, but in a real-world application, you would want to ensure that any new arguments are used as intended within the class.

So, in summary, the error was caused by trying to pass an argument that wasn't accepted by the class constructor, and the solution was to modify the class constructor to accept and handle this argument.

beachboy88 commented 1 year ago

I'm having the same issue and I tried your solution but I'm not I implemented it correctly because I'm still getting the same error messages.

File "plugins\AutoGPTBingAI.zip\AutoGPTBingAI\BingAI__init.py", line 61, in post_prompt File "plugins\AutoGPTBingAI.zip\AutoGPTBingAI\BingAI\bing_ai.py", line 34, in TypeError: Chatbot.init__() got an unexpected keyword argument 'cookie_path'

My question is - Where is the Chatbot class located? Which file? Thank you.

stevielbaby commented 1 year ago

It should be located in the EdgeGPT.py /Auto-GPT/venvAutoGPT/lib/python3.11/site-packages/EdgeGPT.py

stevielbaby commented 1 year ago

I also updated line 34 in the bing_ai.py file to >>> bot = Chatbot(cookies=cookies) # Update this line

I would try first without updating line 34