From fcd558b4c66e6b215a9e1d385698193ebf3b3e4a Mon Sep 17 00:00:00 2001 From: Jonathan Lucas Date: Mon, 19 Aug 2024 13:41:12 -0500 Subject: [PATCH] fixed openai --- chatgpt_telegram_inference_bot.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/chatgpt_telegram_inference_bot.py b/chatgpt_telegram_inference_bot.py index 9bd86d2..88f9c94 100644 --- a/chatgpt_telegram_inference_bot.py +++ b/chatgpt_telegram_inference_bot.py @@ -16,7 +16,8 @@ class ChatGPTTelegramInferenceBot(BaseTelegramInferenceBot): response = self.client.chat.completions.create( model=self.model, messages=[{"role": "system", "content": self.system_prompt}] + messages, - tools=self.functions, + functions=self.functions, + function_call="auto", max_tokens=self.max_tokens ) return response @@ -32,7 +33,7 @@ class ChatGPTTelegramInferenceBot(BaseTelegramInferenceBot): tool_calls = [] assistant_message = {} - + for message_part in response.choices: if message_part.finish_reason == "function_call": tool_calls.append(message_part.message.function_call)