MoondreamService: yield vision response and text frames

This commit is contained in:
Aleix Conchillo Flaqué
2025-12-17 10:36:04 -08:00
parent d3d50ac580
commit 159e403ae4
2 changed files with 8 additions and 6 deletions

View File

@@ -0,0 +1,2 @@
- `MoondreamService` now pushes `VisionFullResponseStartFrame`,
`VisionFullResponseEndFrame` and `VisionTextFrame`.

View File

@@ -19,8 +19,10 @@ from PIL import Image
from pipecat.frames.frames import (
ErrorFrame,
Frame,
TextFrame,
UserImageRawFrame,
VisionFullResponseEndFrame,
VisionFullResponseStartFrame,
VisionTextFrame,
)
from pipecat.services.vision_service import VisionService
@@ -104,10 +106,6 @@ class MoondreamService(VisionService):
Args:
frame: The image frame to process.
Yields:
Frame: TextFrame containing the generated image description, or ErrorFrame
if analysis fails.
"""
if not self._model:
yield ErrorFrame("Moondream model not available")
@@ -123,4 +121,6 @@ class MoondreamService(VisionService):
description = await asyncio.to_thread(get_image_description, frame.image, frame.text)
yield TextFrame(text=description)
yield VisionFullResponseStartFrame()
yield VisionTextFrame(text=description)
yield VisionFullResponseEndFrame()