From fccc91e923fc16617c45c1e001a086c99cfc6d78 Mon Sep 17 00:00:00 2001 From: Filipi Fuchter Date: Tue, 18 Nov 2025 11:50:28 -0300 Subject: [PATCH] Searching in both _function_calls_context_messages and context messages when updating the result. --- .../processors/aggregators/llm_response_universal.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pipecat/processors/aggregators/llm_response_universal.py b/src/pipecat/processors/aggregators/llm_response_universal.py index 98d7514b6..4e9f19ff3 100644 --- a/src/pipecat/processors/aggregators/llm_response_universal.py +++ b/src/pipecat/processors/aggregators/llm_response_universal.py @@ -805,7 +805,12 @@ class LLMAssistantAggregator(LLMContextAggregator): del self._function_calls_in_progress[frame.tool_call_id] def _update_function_call_result(self, function_name: str, tool_call_id: str, result: Any): - for message in self._function_calls_context_messages: + def iter_all(): + yield from self._function_calls_context_messages + # In case on long-running function call, the function may already be added to the context + yield from self._context.get_messages() + + for message in iter_all(): if ( not isinstance(message, LLMSpecificMessage) and message["role"] == "tool"