diff --git a/src/pipecat/services/google/google.py b/src/pipecat/services/google/google.py index 554d9cb6b..3d207a254 100644 --- a/src/pipecat/services/google/google.py +++ b/src/pipecat/services/google/google.py @@ -605,14 +605,14 @@ class GoogleAssistantContextAggregator(OpenAIAssistantContextAggregator): frame.function_name, frame.tool_call_id, frame.result ) else: - response = {"response": "COMPLETED"} await self._update_function_call_result( - frame.function_name, frame.tool_call_id, response + frame.function_name, frame.tool_call_id, "COMPLETED" ) async def handle_function_call_cancel(self, frame: FunctionCallCancelFrame): - response = {"response": "CANCELLED"} - await self._update_function_call_result(frame.function_name, frame.tool_call_id, response) + await self._update_function_call_result( + frame.function_name, frame.tool_call_id, "CANCELLED" + ) async def _update_function_call_result( self, function_name: str, tool_call_id: str, result: Any @@ -621,12 +621,11 @@ class GoogleAssistantContextAggregator(OpenAIAssistantContextAggregator): if message.role == "user": for part in message.parts: if part.function_response and part.function_response.id == tool_call_id: - part.function_response.response = result + part.function_response.response = {"value": json.dumps(result)} async def handle_user_image_frame(self, frame: UserImageRawFrame): - response = {"response": "COMPLETED"} await self._update_function_call_result( - frame.request.function_name, frame.request.tool_call_id, response + frame.request.function_name, frame.request.tool_call_id, "COMPLETED" ) self._context.add_image_frame_message( format=frame.format, diff --git a/tests/test_context_aggregators.py b/tests/test_context_aggregators.py index baee3496f..df00f11e4 100644 --- a/tests/test_context_aggregators.py +++ b/tests/test_context_aggregators.py @@ -735,4 +735,4 @@ class TestGoogleAssistantContextAggregator( def check_function_call_result(self, context: OpenAILLMContext, index: int, content: Any): obj = glm.Content.to_dict(context.messages[index]) - assert obj["parts"][0]["function_response"]["response"] == content + assert obj["parts"][0]["function_response"]["response"]["value"] == json.dumps(content)