[Bug]: Can't get attribute 'CompletionTokensDetails' on <module 'openai.types.completion_usage
Describe the bug
I have NO idea what this means.
Using: openai==1.16.2 pyautogen==0.3.0
Screenshots and logs
Here is the full trace:
File ".venv\Lib\site-packages\autogen\agentchat\chat.py", line 232, in _on_chat_future_done chat_result = chat_future.result() ^^^^^^^^^^^^^^^^^^^^ File ".venv\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 1168, in a_initiate_chat await self.a_send(msg2send, recipient, silent=silent) File ".venv\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 788, in a_send await recipient.a_receive(message, self, request_reply, silent) File ".venv\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 939, in a_receive reply = await self.a_generate_reply(sender=sender) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File ".venv\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 2126, in a_generate_reply final, reply = await reply_func( ^^^^^^^^^^^^^^^^^ File ".venv\Lib\site-packages\autogen\agentchat\groupchat.py", line 1191, in a_run_chat reply = await speaker.a_generate_reply(sender=self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File ".venv\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 2126, in a_generate_reply final, reply = await reply_func( ^^^^^^^^^^^^^^^^^ File .venv\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 1484, in a_generate_oai_reply return await asyncio.get_event_loop().run_in_executor( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "AppData\Local\Programs\Python\Python311\Lib\concurrent\futures\thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File ".venv\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 1482, in _generate_oai_reply return self.generate_oai_reply(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File ".venv\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 1424, in generate_oai_reply extracted_response = self._generate_oai_reply_from_client( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File ".venv\Lib\site-packages\autogen\agentchat\conversable_agent.py", line 1443, in _generate_oai_reply_from_client response = llm_client.create( ^^^^^^^^^^^^^^^^^^ File ".venv\Lib\site-packages\autogen\oai\client.py", line 728, in create response: ModelClient.ModelClientResponseProtocol = cache.get(key, None) ^^^^^^^^^^^^^^^^^^^^ File ".venv\Lib\site-packages\autogen\cache\disk_cache.py", line 63, in get return self.cache.get(key, default) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File ".venv\Lib\site-packages\diskcache\core.py", line 1173, in get value = self._disk.fetch(mode, filename, db_value, read) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File ".venv\Lib\site-packages\diskcache\core.py", line 284, in fetch return pickle.load(io.BytesIO(value)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: Can't get attribute 'CompletionTokensDetails' on <module 'openai.types.completion_usage' from '\.venv\Lib\site-packages\openai\types\completion_usage.py'> WARNING:autogen.io.websockets: - IOWebsockets._handler(): Error in on_connect: Can't get attribute 'CompletionTokensDetails' on <module 'openai.types.completion_usage' from '\.venv\Lib\site-packages\openai\types\completion_usage.py'> DEBUG:websockets.server:> CLOSE 1000 (OK) [2 bytes]
@Tylersuard: Thanks for reporting this issue!
To help us investigate further, could you provide a minimal code example that reproduces this error? This will make it easier to understand and address the problem.
We appreciate your help in resolving this!
@Tylersuard do you still have the same issue with the latest package ag2 and latest version? Let me us if you do. Will investigate!