diff --git a/src/pipecat/services/openai/base_llm.py b/src/pipecat/services/openai/base_llm.py index 53de03d09..fe735daeb 100644 --- a/src/pipecat/services/openai/base_llm.py +++ b/src/pipecat/services/openai/base_llm.py @@ -528,7 +528,7 @@ class BaseOpenAILLMService(LLMService): tool_call = chunk.choices[0].delta.tool_calls[0] if tool_call.index != func_idx: functions_list.append(function_name) - arguments_list.append(arguments) + arguments_list.append(arguments or "{}") tool_id_list.append(tool_call_id) function_name = "" arguments = "" @@ -554,10 +554,10 @@ class BaseOpenAILLMService(LLMService): # a registered handler. If so, run the registered callback, save the result to # the context, and re-prompt to get a chat answer. If we don't have a registered # handler, raise an exception. - if function_name and arguments: + if function_name: # added to the list as last function name and arguments not added to the list functions_list.append(function_name) - arguments_list.append(arguments) + arguments_list.append(arguments or "{}") tool_id_list.append(tool_call_id) function_calls = []