From b013e375fb90f0810e1c1b367b5834e5f70d8fdc Mon Sep 17 00:00:00 2001 From: Paul Kompfner Date: Wed, 7 May 2025 10:38:23 -0400 Subject: [PATCH] [WIP] AWS Nova Sonic service - simplify a bit of logic (and do the same simplification in the OpenAI Realtime service) --- src/pipecat/services/aws_nova_sonic/aws.py | 9 +-------- src/pipecat/services/openai_realtime_beta/openai.py | 10 +--------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/src/pipecat/services/aws_nova_sonic/aws.py b/src/pipecat/services/aws_nova_sonic/aws.py index 6838daad6..3f41a0166 100644 --- a/src/pipecat/services/aws_nova_sonic/aws.py +++ b/src/pipecat/services/aws_nova_sonic/aws.py @@ -782,14 +782,7 @@ class AWSNovaSonicLLMService(LLMService): # Call tool function if self.has_function(function_name): - if function_name in self._functions.keys(): - await self.call_function( - context=self._context, - tool_call_id=tool_call_id, - function_name=function_name, - arguments=arguments, - ) - elif None in self._functions.keys(): + if function_name in self._functions.keys() or None in self._functions.keys(): await self.call_function( context=self._context, tool_call_id=tool_call_id, diff --git a/src/pipecat/services/openai_realtime_beta/openai.py b/src/pipecat/services/openai_realtime_beta/openai.py index 334ce98c8..0c37f73ce 100644 --- a/src/pipecat/services/openai_realtime_beta/openai.py +++ b/src/pipecat/services/openai_realtime_beta/openai.py @@ -577,15 +577,7 @@ class OpenAIRealtimeBetaLLMService(LLMService): arguments = json.loads(item.arguments) if self.has_function(function_name): run_llm = index == total_items - 1 - if function_name in self._functions.keys(): - await self.call_function( - context=self._context, - tool_call_id=tool_id, - function_name=function_name, - arguments=arguments, - run_llm=run_llm, - ) - elif None in self._functions.keys(): + if function_name in self._functions.keys() or None in self._functions.keys(): await self.call_function( context=self._context, tool_call_id=tool_id,