LLMAssistantAggregator: don't mark function calls as completed when receiving user image

Before, when requesting a user image from a function call we had to wait for a
random time before we could indicate the function call was done. This was to
given time to the aggregator to process the image before marking the function
call as completed.

To avoid this, we now wait for the requested image to be received by the LLM
assistant agrgegator (using an asyncio event). Then, we can successfully mark
the function call as completed.
This commit is contained in:
Aleix Conchillo Flaqué
2025-10-29 11:02:45 -07:00
parent 9c5690d670
commit 5174b18176
3 changed files with 21 additions and 7 deletions

View File

@@ -11,6 +11,7 @@ including data frames, system frames, and control frames for audio, video, text,
and LLM processing.
"""
import asyncio
from dataclasses import dataclass, field
from typing import (
TYPE_CHECKING,
@@ -1218,6 +1219,7 @@ class UserImageRequestFrame(SystemFrame):
function_name: Optional[str] = None
tool_call_id: Optional[str] = None
video_source: Optional[str] = None
request_event: Optional[asyncio.Event] = None
def __str__(self):
return f"{self.name}(user: {self.user_id}, video_source: {self.video_source}, function: {self.function_name}, request: {self.tool_call_id})"