n3d1117 / chatgpt-telegram-bot

🤖 A Telegram bot that integrates with OpenAI's official ChatGPT APIs to provide answers, written in Python
GNU General Public License v2.0
3k stars 1.38k forks source link

o1 model #634

Open n-10-v opened 2 weeks ago

n-10-v commented 2 weeks ago

Does anyone have a workaround to add the new o1 model?

SkySlider commented 1 week ago

635

rainbowjose commented 1 week ago

635

chatgpttelegrambot-chatgpt-telegram-bot-1 | create() got an unexpected keyword argument 'max_completion_tokens' chatgpttelegrambot-chatgpt-telegram-bot-1 | Traceback (most recent call last): chatgpttelegrambot-chatgpt-telegram-bot-1 | File "/app/bot/openai_helper.py", line 279, in common_get_chat_response chatgpttelegrambot-chatgpt-telegram-bot-1 | return await self.client.chat.completions.create(*common_args) chatgpttelegrambot-chatgpt-telegram-bot-1 | File "/usr/local/lib/python3.9/site-packages/openai/_utils/_utils.py", line 277, in wrapper chatgpttelegrambot-chatgpt-telegram-bot-1 | return func(args, **kwargs) chatgpttelegrambot-chatgpt-telegram-bot-1 | TypeError: create() got an unexpected keyword argument 'max_completion_tokens' chatgpttelegrambot-chatgpt-telegram-bot-1 | chatgpttelegrambot-chatgpt-telegram-bot-1 | The above exception was the direct cause of the following exception: chatgpttelegrambot-chatgpt-telegram-bot-1 | chatgpttelegrambot-chatgpt-telegram-bot-1 | Traceback (most recent call last): chatgpttelegrambot-chatgpt-telegram-bot-1 | File "/app/bot/telegram_bot.py", line 798, in prompt chatgpttelegrambot-chatgpt-telegram-bot-1 | await wrap_with_indicator(update, context, _reply, constants.ChatAction.TYPING) chatgpttelegrambot-chatgpt-telegram-bot-1 | File "/app/bot/utils.py", line 100, in wrap_with_indicator chatgpttelegrambot-chatgpt-telegram-bot-1 | await asyncio.wait_for(asyncio.shield(task), 4.5) chatgpttelegrambot-chatgpt-telegram-bot-1 | File "/usr/local/lib/python3.9/asyncio/tasks.py", line 479, in wait_for chatgpttelegrambot-chatgpt-telegram-bot-1 | return fut.result() chatgpttelegrambot-chatgpt-telegram-bot-1 | File "/usr/local/lib/python3.9/site-packages/telegram/ext/_application.py", line 1184, in __create_task_callback chatgpttelegrambot-chatgpt-telegram-bot-1 | raise exception chatgpttelegrambot-chatgpt-telegram-bot-1 | File "/usr/local/lib/python3.9/site-packages/telegram/ext/_application.py", line 1161, in create_task_callback chatgpttelegrambot-chatgpt-telegram-bot-1 | return await coroutine # type: ignore[misc] chatgpttelegrambot-chatgpt-telegram-bot-1 | File "/app/bot/telegram_bot.py", line 770, in _reply chatgpttelegrambot-chatgpt-telegram-bot-1 | response, total_tokens = await self.openai.get_chat_response(chat_id=chat_id, query=prompt) chatgpttelegrambot-chatgpt-telegram-bot-1 | File "/app/bot/openai_helper.py", line 142, in get_chat_response chatgpttelegrambot-chatgpt-telegram-bot-1 | response = await self.common_get_chat_response(chat_id, query) chatgpttelegrambot-chatgpt-telegram-bot-1 | File "/usr/local/lib/python3.9/site-packages/tenacity/_asyncio.py", line 142, in async_wrapped chatgpttelegrambot-chatgpt-telegram-bot-1 | return await fn(*args, *kwargs) chatgpttelegrambot-chatgpt-telegram-bot-1 | File "/usr/local/lib/python3.9/site-packages/tenacity/_asyncio.py", line 58, in call chatgpttelegrambot-chatgpt-telegram-bot-1 | do = await self.iter(retry_state=retry_state) chatgpttelegrambot-chatgpt-telegram-bot-1 | File "/usr/local/lib/python3.9/site-packages/tenacity/_asyncio.py", line 110, in iter chatgpttelegrambot-chatgpt-telegram-bot-1 | result = await action(retry_state) chatgpttelegrambot-chatgpt-telegram-bot-1 | File "/usr/local/lib/python3.9/site-packages/tenacity/_asyncio.py", line 78, in inner chatgpttelegrambot-chatgpt-telegram-bot-1 | return fn(args, **kwargs) chatgpttelegrambot-chatgpt-telegram-bot-1 | File "/usr/local/lib/python3.9/site-packages/tenacity/init.py", line 390, in chatgpttelegrambot-chatgpt-telegram-bot-1 | self._add_action_func(lambda rs: rs.outcome.result()) chatgpttelegrambot-chatgpt-telegram-bot-1 | File "/usr/local/lib/python3.9/concurrent/futures/_base.py", line 439, in result chatgpttelegrambot-chatgpt-telegram-bot-1 | return self.get_result() chatgpttelegrambot-chatgpt-telegram-bot-1 | File "/usr/local/lib/python3.9/concurrent/futures/_base.py", line 391, in get_result chatgpttelegrambot-chatgpt-telegram-bot-1 | raise self._exception chatgpttelegrambot-chatgpt-telegram-bot-1 | File "/usr/local/lib/python3.9/site-packages/tenacity/_asyncio.py", line 61, in call chatgpttelegrambot-chatgpt-telegram-bot-1 | result = await fn(*args, **kwargs) chatgpttelegrambot-chatgpt-telegram-bot-1 | File "/app/bot/openai_helper.py", line 288, in common_get_chatresponse chatgpttelegrambot-chatgpt-telegram-bot-1 | raise Exception(f"⚠️ {localized_text('error', botlanguage)}. ⚠️\n{str(e)}") from e

SkySlider commented 1 week ago

@rainbowjose Try updating openai pip package