From d10702f65620daf0b04b334617ea1031d1d50c40 Mon Sep 17 00:00:00 2001 From: Jonathan Lucas Date: Sun, 18 Aug 2024 10:45:03 -0500 Subject: [PATCH] fix for openai call --- telegram_inference_bot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/telegram_inference_bot.py b/telegram_inference_bot.py index cd517ed..3bc6c8f 100644 --- a/telegram_inference_bot.py +++ b/telegram_inference_bot.py @@ -102,7 +102,7 @@ async def handle_message(update: Update, context: ContextTypes.DEFAULT_TYPE) -> tool_calls = None else: assistant_message = response.choices[0].message - if hasattr(assistant_message, 'function_call'): + if hasattr(assistant_message, 'function_call') and assistant_message.function_call is not None: tool_calls.append(assistant_message.function_call) toolUseCount = 0 @@ -132,7 +132,7 @@ async def handle_message(update: Update, context: ContextTypes.DEFAULT_TYPE) -> tool_calls = None else: assistant_message = response.choices[0].message - if assistant_message.function_call is not None: + if hasattr(assistant_message, 'function_call') and assistant_message.function_call is not None: tool_calls.append(assistant_message.function_call) toolUseCount += 1