fix for openai call

This commit is contained in:
2024-08-18 10:45:03 -05:00
parent 0b28b9a39d
commit d10702f656
+2 -2
View File
@@ -102,7 +102,7 @@ async def handle_message(update: Update, context: ContextTypes.DEFAULT_TYPE) ->
tool_calls = None tool_calls = None
else: else:
assistant_message = response.choices[0].message 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) tool_calls.append(assistant_message.function_call)
toolUseCount = 0 toolUseCount = 0
@@ -132,7 +132,7 @@ async def handle_message(update: Update, context: ContextTypes.DEFAULT_TYPE) ->
tool_calls = None tool_calls = None
else: else:
assistant_message = response.choices[0].message 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) tool_calls.append(assistant_message.function_call)
toolUseCount += 1 toolUseCount += 1