From 8ddac0ccd8880dd9b836bf0775f3e2d11abb7f19 Mon Sep 17 00:00:00 2001 From: Kwindla Hultman Kramer Date: Thu, 21 Nov 2024 10:33:12 -0800 Subject: [PATCH] Testing with gemini-exp-1114. Bug fix --- examples/foundational/07p-interruptible-google-audio-in.py | 6 +++++- examples/foundational/14e-function-calling-gemini.py | 7 +++++-- src/pipecat/services/google.py | 7 ++++--- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/examples/foundational/07p-interruptible-google-audio-in.py b/examples/foundational/07p-interruptible-google-audio-in.py index 40389274a..1778e0c62 100644 --- a/examples/foundational/07p-interruptible-google-audio-in.py +++ b/examples/foundational/07p-interruptible-google-audio-in.py @@ -217,7 +217,11 @@ async def main(): voice_id="79a125e8-cd45-4c13-8a67-188112f4dd22", # British Lady ) - llm = GoogleLLMService(model="gemini-1.5-flash-latest", api_key=os.getenv("GOOGLE_API_KEY")) + llm = GoogleLLMService( + model="gemini-1.5-flash-latest", + # model="gemini-exp-1114", + api_key=os.getenv("GOOGLE_API_KEY"), + ) messages = [ { diff --git a/examples/foundational/14e-function-calling-gemini.py b/examples/foundational/14e-function-calling-gemini.py index 087794a11..ede7222bb 100644 --- a/examples/foundational/14e-function-calling-gemini.py +++ b/examples/foundational/14e-function-calling-gemini.py @@ -64,7 +64,11 @@ async def main(): voice_id="79a125e8-cd45-4c13-8a67-188112f4dd22", # British Lady ) - llm = GoogleLLMService(model="gemini-1.5-flash-latest", api_key=os.getenv("GOOGLE_API_KEY")) + llm = GoogleLLMService( + model="gemini-1.5-flash-latest", + # model="gemini-exp-1114", + api_key=os.getenv("GOOGLE_API_KEY"), + ) llm.register_function("get_weather", get_weather) llm.register_function("get_image", get_image) @@ -151,7 +155,6 @@ indicate you should use the get_image tool are: allow_interruptions=True, enable_metrics=True, enable_usage_metrics=True, - report_only_initial_ttfb=True, ), ) diff --git a/src/pipecat/services/google.py b/src/pipecat/services/google.py index f945fa53d..54f9d67aa 100644 --- a/src/pipecat/services/google.py +++ b/src/pipecat/services/google.py @@ -281,9 +281,10 @@ class GoogleAssistantContextAggregator(OpenAIAssistantContextAggregator): ) run_llm = not bool(self._function_calls_in_progress) else: - self._context.add_message( - glm.Content(role="model", parts=[glm.Part(text=aggregation)]) - ) + if aggregation.strip(): + self._context.add_message( + glm.Content(role="model", parts=[glm.Part(text=aggregation)]) + ) if self._pending_image_frame_message: frame = self._pending_image_frame_message