image_service
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(*, settings: ImageGenSettings | None = None, **kwargs)[source]
Bases:
AIServiceBase 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.
- __init__(*, settings: ImageGenSettings | None = None, **kwargs)[source]
Initialize the image generation service.
- Parameters:
settings – The runtime-updatable settings for the image generation service.
**kwargs – Additional arguments passed to the parent AIService.
- abstractmethod async run_image_gen(prompt: str) AsyncGenerator[Frame, None][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 – The text prompt to generate an image from.
- Yields:
Frame –
- Frames containing the generated image (typically ImageRawFrame
or URLImageRawFrame).
- async process_frame(frame: Frame, direction: FrameDirection)[source]
Process frames for image generation.
TextFrames are used as prompts for image generation, while other frames are passed through unchanged.
- Parameters:
frame – The frame to process.
direction – The direction of frame processing.