From 687b3d9d4c0eb6c25c16904662c009a9529584ae Mon Sep 17 00:00:00 2001 From: Vaibhav159 Date: Wed, 12 Feb 2025 22:22:04 +0530 Subject: [PATCH] fixing google llm service error --- CHANGELOG.md | 4 ++++ src/pipecat/services/google/google.py | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 217474f5f..8a38f4c9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -61,6 +61,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed an issue[#1192] in 11labs where we are trying to reconnect/disconnect the websocket connection even when the connection is already closed. +- Fixed an issue where `has_regular_messages` condition was always been true in + `GoogleLLMContext` due to `Part` having `function_call` & `function_response` with + `None` values. + ## [0.0.56] - 2025-02-06 ### Changed diff --git a/src/pipecat/services/google/google.py b/src/pipecat/services/google/google.py index dea2f5ab7..7e32fa63f 100644 --- a/src/pipecat/services/google/google.py +++ b/src/pipecat/services/google/google.py @@ -604,9 +604,9 @@ class GoogleLLMContext(OpenAILLMContext): # Check if we only have function-related messages (no regular text) has_regular_messages = any( len(msg.parts) == 1 - and hasattr(msg.parts[0], "text") - and not hasattr(msg.parts[0], "function_call") - and not hasattr(msg.parts[0], "function_response") + and not getattr(msg.parts[0], "text", None) + and getattr(msg.parts[0], "function_call", None) + and getattr(msg.parts[0], "function_response", None) for msg in self._messages )