ChatDev icon indicating copy to clipboard operation
ChatDev copied to clipboard

tenacity.RetryError: RetryError[<Future at 0x1467ed97eb0 state=finished raised AuthenticationError>]

Open kiperkhm opened this issue 1 year ago • 4 comments

`(ChatDev_conda_env) C:\Windows\System32\ChatDev>python run.py --task "[sandbox survival]" --name "[Fifth_Attempt]" [Preprocessing]

ChatDev Starts (20240831010035)

Timestamp: 20240831010035

config_path: C:\Windows\System32\ChatDev\CompanyConfig\Default\ChatChainConfig.json

config_phase_path: C:\Windows\System32\ChatDev\CompanyConfig\Default\PhaseConfig.json

config_role_path: C:\Windows\System32\ChatDev\CompanyConfig\Default\RoleConfig.json

task_prompt: [sandbox survival]

project_name: [Fifth_Attempt]

Log File: C:\Windows\System32\ChatDev\WareHouse[Fifth_Attempt]_DefaultOrganization_20240831010035.log

ChatDevConfig: ChatEnvConfig.with_memory: False ChatEnvConfig.clear_structure: True ChatEnvConfig.git_management: False ChatEnvConfig.gui_design: True ChatEnvConfig.incremental_develop: False ChatEnvConfig.background_prompt: ChatDev is a software company powered by multiple intelligent agents, such as chief executive officer, chief human resources officer, chief product officer, chief technology officer, etc, with a multi-agent organizational structure and the mission of 'changing the digital world through programming'.

ChatGPTConfig: ChatGPTConfig(temperature=0.2, top_p=1.0, n=1, stream=False, stop=None, max_tokens=None, presence_penalty=0.0, frequency_penalty=0.0, logit_bias={}, user='')

System: [chatting]

Parameter Value
task_prompt [sandbox survival]
need_reflect True
assistant_role_name Chief Product Officer
user_role_name Chief Executive Officer
phase_prompt ChatDev has made products in the following form before: Image: can present information in line chart, bar chart, flow chart, cloud chart, Gantt chart, etc. Document: can present information via .docx files. PowerPoint: can present information via .pptx files. Excel: can present information via .xlsx files. PDF: can present information via .pdf files. Website: can present personal resume, tutorial, products, or ideas, via .html files. Application: can implement visualized game, software, tool, etc, via python. Dashboard: can display a panel visualizing real-time information. Mind Map: can represent ideas, with related concepts arranged around a core concept. As the {assistant_role}, to satisfy the new user's demand and the product should be realizable, you should keep discussing with me to decide which product modality do we want the product to be? Note that we must ONLY discuss the product modality and do not discuss anything else! Once we all have expressed our opinion(s) and agree with the results of the discussion unanimously, any of us must actively terminate the discussion by replying with only one line, which starts with a single word , followed by our final product modality without any other words, e.g., " PowerPoint".
phase_name DemandAnalysis
assistant_role_prompt {chatdev_prompt} You are Chief Product Officer. we are both working at ChatDev. We share a common interest in collaborating to successfully complete a task assigned by a new customer. You are responsible for all product-related matters in ChatDev. Usually includes product design, product strategy, product vision, product innovation, project management and product marketing. Here is a new customer's task: {task}. To complete the task, you must write a response that appropriately solves the requested instruction based on your expertise and customer's needs.
user_role_prompt {chatdev_prompt} You are Chief Executive Officer. Now, we are both working at ChatDev and we share a common interest in collaborating to successfully complete a task assigned by a new customer. Your main responsibilities include being an active decision-maker on users' demands and other key policy issues, leader, manager, and executor. Your decision-making role involves high-level decisions about policy and strategy; and your communicator role can involve speaking to the organization's management and employees. Here is a new customer's task: {task}. To complete the task, I will give you one or more instructions, and you must help me to write a specific solution that appropriately solves the requested instruction based on your expertise and my needs.
chat_turn_limit 10
placeholders {}
memory No existed memory
model_type ModelType.GPT_3_5_TURBO_NEW

System: [RolePlaying]

Parameter Value
assistant_role_name Chief Product Officer
user_role_name Chief Executive Officer
assistant_role_prompt {chatdev_prompt} You are Chief Product Officer. we are both working at ChatDev. We share a common interest in collaborating to successfully complete a task assigned by a new customer. You are responsible for all product-related matters in ChatDev. Usually includes product design, product strategy, product vision, product innovation, project management and product marketing. Here is a new customer's task: {task}. To complete the task, you must write a response that appropriately solves the requested instruction based on your expertise and customer's needs.
user_role_prompt {chatdev_prompt} You are Chief Executive Officer. Now, we are both working at ChatDev and we share a common interest in collaborating to successfully complete a task assigned by a new customer. Your main responsibilities include being an active decision-maker on users' demands and other key policy issues, leader, manager, and executor. Your decision-making role involves high-level decisions about policy and strategy; and your communicator role can involve speaking to the organization's management and employees. Here is a new customer's task: {task}. To complete the task, I will give you one or more instructions, and you must help me to write a specific solution that appropriately solves the requested instruction based on your expertise and my needs.
task_prompt [sandbox survival]
with_task_specify False
memory No existed memory
model_type ModelType.GPT_3_5_TURBO_NEW
background_prompt ChatDev is a software company powered by multiple intelligent agents, such as chief executive officer, chief human resources officer, chief product officer, chief technology officer, etc, with a multi-agent organizational structure and the mission of 'changing the digital world through programming'.

Chief Executive Officer: [Start Chat]

[ChatDev is a software company powered by multiple intelligent agents, such as chief executive officer, chief human resources officer, chief product officer, chief technology officer, etc, with a multi-agent organizational structure and the mission of 'changing the digital world through programming'. You are Chief Product Officer. we are both working at ChatDev. We share a common interest in collaborating to successfully complete a task assigned by a new customer. You are responsible for all product-related matters in ChatDev. Usually includes product design, product strategy, product vision, product innovation, project management and product marketing. Here is a new customer's task: [sandbox survival]. To complete the task, you must write a response that appropriately solves the requested instruction based on your expertise and customer's needs.]

ChatDev has made products in the following form before:

Image: can present information in line chart, bar chart, flow chart, cloud chart, Gantt chart, etc.

Document: can present information via .docx files.

PowerPoint: can present information via .pptx files.

Excel: can present information via .xlsx files.

PDF: can present information via .pdf files.

Website: can present personal resume, tutorial, products, or ideas, via .html files.

Application: can implement visualized game, software, tool, etc, via python.

Dashboard: can display a panel visualizing real-time information.

Mind Map: can represent ideas, with related concepts arranged around a core concept.

As the Chief Product Officer, to satisfy the new user's demand and the product should be realizable, you should keep discussing with me to decide which product modality do we want the product to be?

Note that we must ONLY discuss the product modality and do not discuss anything else! Once we all have expressed our opinion(s) and agree with the results of the discussion unanimously, any of us must actively terminate the discussion by replying with only one line, which starts with a single word <INFO>, followed by our final product modality without any other words, e.g., "<INFO> PowerPoint".

Traceback (most recent call last): File "C:\ProgramData\anaconda3\envs\ChatDev_conda_env\lib\site-packages\tenacity_init_.py", line 382, in call result = fn(*args, kwargs) File "C:\Windows\System32\ChatDev\camel\utils.py", line 160, in wrapper return func(self, *args, kwargs) File "C:\Windows\System32\ChatDev\camel\agents\chat_agent.py", line 239, in step response = self.model_backend.run(messages=openai_messages) File "C:\Windows\System32\ChatDev\camel\model_backend.py", line 101, in run response = client.chat.completions.create(*args, kwargs, model=self.model_type.value, File "C:\ProgramData\anaconda3\envs\ChatDev_conda_env\lib\site-packages\openai_utils_utils.py", line 299, in wrapper return func(*args, kwargs) File "C:\ProgramData\anaconda3\envs\ChatDev_conda_env\lib\site-packages\openai\resources\chat\completions.py", line 598, in create return self._post( File "C:\ProgramData\anaconda3\envs\ChatDev_conda_env\lib\site-packages\openai_base_client.py", line 1055, in post return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)) File "C:\ProgramData\anaconda3\envs\ChatDev_conda_env\lib\site-packages\openai_base_client.py", line 834, in request return self._request( File "C:\ProgramData\anaconda3\envs\ChatDev_conda_env\lib\site-packages\openai_base_client.py", line 877, in _request raise self._make_status_error_from_response(err.response) from None openai.AuthenticationError: Error code: 401 - {'error': {'message': 'Incorrect API key provided: sk-Hd-xi***************************************************************************nVgA. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "C:\Windows\System32\ChatDev\run.py", line 136, in chat_chain.execute_chain() File "C:\Windows\System32\ChatDev\chatdev\chat_chain.py", line 168, in execute_chain self.execute_step(phase_item) File "C:\Windows\System32\ChatDev\chatdev\chat_chain.py", line 138, in execute_step self.chat_env = self.phases[phase].execute(self.chat_env, File "C:\Windows\System32\ChatDev\chatdev\phase.py", line 295, in execute self.chatting(chat_env=chat_env, File "C:\Windows\System32\ChatDev\chatdev\utils.py", line 79, in wrapper return func(*args, **kwargs) File "C:\Windows\System32\ChatDev\chatdev\phase.py", line 133, in chatting assistant_response, user_response = role_play_session.step(input_user_msg, chat_turn_limit == 1) File "C:\Windows\System32\ChatDev\camel\agents\role_playing.py", line 247, in step assistant_response = self.assistant_agent.step(user_msg_rst) File "C:\ProgramData\anaconda3\envs\ChatDev_conda_env\lib\site-packages\tenacity_init_.py", line 289, in wrapped_f return self(f, *args, **kw) File "C:\ProgramData\anaconda3\envs\ChatDev_conda_env\lib\site-packages\tenacity_init_.py", line 379, in call do = self.iter(retry_state=retry_state) File "C:\ProgramData\anaconda3\envs\ChatDev_conda_env\lib\site-packages\tenacity_init_.py", line 326, in iter raise retry_exc from fut.exception() tenacity.RetryError: RetryError[<Future at 0x1467ed97eb0 state=finished raised AuthenticationError>]`

kiperkhm avatar Aug 30 '24 16:08 kiperkhm

I insralled requirements , I setted new openai api. What should I do?

kiperkhm avatar Aug 30 '24 16:08 kiperkhm

please note the error in your log, which is

openai.AuthenticationError: Error code: 401 - {'error': {'message': 'Incorrect API key provided: sk-Hd-xi***************************************************************************nVgA. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}

so your openai key is invalid. Please use the correct openai key

thinkwee avatar Sep 04 '24 04:09 thinkwee

please note the error in your log, which is

openai.AuthenticationError: Error code: 401 - {'error': {'message': 'Incorrect API key provided: sk-Hd-xi***************************************************************************nVgA. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}

so your openai key is invalid. Please use the correct openai key

I've seen error code 401 time and time again. After continuously changing openapikey, I tried again, but the same problem occurred and I uploaded it.

kiperkhm avatar Sep 04 '24 08:09 kiperkhm

I'm sorry, but it seems that this issue is not caused by ChatDev. Maybe you can write a toy example (like querying a "hello") to check the availability of your key.

thinkwee avatar Sep 06 '24 08:09 thinkwee