diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c6ff6143..6ceee64ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -108,6 +108,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Restore backwards compatibility for vision/image features (broken in 0.0.92) + when using non-universal context and assistant aggregators. + - Fixed `DeepgramSTTService._disconnect()` to properly await `is_connected()` method call, which is an async coroutine in the Deepgram SDK. diff --git a/src/pipecat/frames/frames.py b/src/pipecat/frames/frames.py index 5db02c856..3e92b8480 100644 --- a/src/pipecat/frames/frames.py +++ b/src/pipecat/frames/frames.py @@ -1215,12 +1215,32 @@ class UserImageRequestFrame(SystemFrame): text: An optional text associated to the image request. append_to_context: Whether the requested image should be appended to the LLM context. video_source: Specific video source to capture from. + context: [DEPRECATED] Optional context for the image request. + function_name: [DEPRECATED] Name of function that generated this request (if any). + tool_call_id: [DEPRECATED] Tool call ID if generated by function call. """ user_id: str text: Optional[str] = None append_to_context: Optional[bool] = None video_source: Optional[str] = None + context: Optional[Any] = None + function_name: Optional[str] = None + tool_call_id: Optional[str] = None + + def __post_init__(self): + super().__post_init__() + + if self.context or self.function_name or self.tool_call_id: + import warnings + + with warnings.catch_warnings(): + warnings.simplefilter("always") + warnings.warn( + "`UserImageRequestFrame` fields `context`, `function_name` and `tool_call_id` are deprecated.", + DeprecationWarning, + stacklevel=2, + ) def __str__(self): return f"{self.name}(user: {self.user_id}, text: {self.text}, append_to_context: {self.append_to_context}, {self.video_source})" @@ -1299,11 +1319,27 @@ class UserImageRawFrame(InputImageRawFrame): user_id: Identifier of the user who provided this image. text: An optional text associated to this image. append_to_context: Whether the requested image should be appended to the LLM context. + request: [DEPRECATED] The original image request frame if this is a response. """ user_id: str = "" text: Optional[str] = None append_to_context: Optional[bool] = None + request: Optional[UserImageRequestFrame] = None + + def __post_init__(self): + super().__post_init__() + + if self.request: + import warnings + + with warnings.catch_warnings(): + warnings.simplefilter("always") + warnings.warn( + "`UserImageRawFrame` field `request` is deprecated.", + DeprecationWarning, + stacklevel=2, + ) def __str__(self): pts = format_pts(self.pts) diff --git a/src/pipecat/services/llm_service.py b/src/pipecat/services/llm_service.py index 7f743354d..272df1762 100644 --- a/src/pipecat/services/llm_service.py +++ b/src/pipecat/services/llm_service.py @@ -509,7 +509,14 @@ class LLMService(AIService): DeprecationWarning, ) await self.push_frame( - UserImageRequestFrame(user_id=user_id, text=text_content), + UserImageRequestFrame( + user_id=user_id, + text=text_content, + # Deprecated fields below. + function_name=function_name, + tool_call_id=tool_call_id, + context=text_content, + ), FrameDirection.UPSTREAM, ) diff --git a/src/pipecat/transports/daily/transport.py b/src/pipecat/transports/daily/transport.py index ce97eb4dc..51ef637b8 100644 --- a/src/pipecat/transports/daily/transport.py +++ b/src/pipecat/transports/daily/transport.py @@ -1844,6 +1844,8 @@ class DailyInputTransport(BaseInputTransport): format=video_frame.color_format, text=request_frame.text if request_frame else None, append_to_context=request_frame.append_to_context if request_frame else None, + # Deprecated fields below. + request=request_frame, ) frame.transport_source = video_source await self.push_video_frame(frame) diff --git a/src/pipecat/transports/smallwebrtc/transport.py b/src/pipecat/transports/smallwebrtc/transport.py index 6c2854e9a..0e2ea544e 100644 --- a/src/pipecat/transports/smallwebrtc/transport.py +++ b/src/pipecat/transports/smallwebrtc/transport.py @@ -672,6 +672,8 @@ class SmallWebRTCInputTransport(BaseInputTransport): format=video_frame.format, text=request_text, append_to_context=add_to_context, + # Deprecated fields below. + request=request_frame, ) image_frame.transport_source = video_source # Push the frame to the pipeline