ImageService
Image generation service implementation.
Provides base functionality for AI-powered image generation services that convert text prompts into images.
- class pipecat.services.image_service.ImageGenService(**kwargs)[source]
Bases:
AIService
Base class for image generation services.
Processes TextFrames by using their content as prompts for image generation. Subclasses must implement the run_image_gen method to provide actual image generation functionality using their specific AI service.
- Parameters:
**kwargs – Additional arguments passed to the parent AIService.
- abstractmethod async run_image_gen(prompt)[source]
Generate an image from a text prompt.
This method must be implemented by subclasses to provide actual image generation functionality using their specific AI service.
- Parameters:
prompt (str) – The text prompt to generate an image from.
- Yields:
Frame –
- Frames containing the generated image (typically ImageRawFrame
or URLImageRawFrame).
- Return type:
AsyncGenerator[Frame, None]
- async process_frame(frame, direction)[source]
Process frames for image generation.
TextFrames are used as prompts for image generation, while other frames are passed through unchanged.
- Parameters:
frame (Frame) – The frame to process.
direction (FrameDirection) – The direction of frame processing.