diff --git a/src/pipecat/services/ai_services.py b/src/pipecat/services/ai_services.py index 817af145f..a4e9fd4d6 100644 --- a/src/pipecat/services/ai_services.py +++ b/src/pipecat/services/ai_services.py @@ -22,6 +22,7 @@ from pipecat.frames.frames import ( TTSSpeakFrame, TTSVoiceUpdateFrame, TextFrame, + UserImageRequestFrame, VisionImageRawFrame ) from pipecat.processors.async_frame_processor import AsyncFrameProcessor @@ -143,6 +144,10 @@ class LLMService(AIService): elif None in self._start_callbacks.keys(): return await self._start_callbacks[None](self, context, function_name) + async def request_image_frame(self, user_id: str, *, text_content: str | None = None): + await self.push_frame(UserImageRequestFrame(user_id=user_id, context=text_content), + FrameDirection.UPSTREAM) + class TTSService(AIService): def __init__( diff --git a/src/pipecat/services/anthropic.py b/src/pipecat/services/anthropic.py index 76cdaef2c..f8c21f4e5 100644 --- a/src/pipecat/services/anthropic.py +++ b/src/pipecat/services/anthropic.py @@ -240,10 +240,6 @@ class AnthropicLLMService(LLMService): if context: await self._process_context(context) - async def request_image_frame(self, user_id: str, *, text_content: str = None): - await self.push_frame(UserImageRequestFrame(user_id=user_id, context=text_content), - FrameDirection.UPSTREAM) - def _estimate_tokens(self, text: str) -> int: return int(len(re.split(r'[^\w]+', text)) * 1.3)