image
Fal’s image generation service implementation.
This module provides integration with Fal’s image generation API for creating images from text prompts using various AI models.
- class pipecat.services.fal.image.FalImageGenSettings(model: str | None | NotGiven = <factory>, extra: dict[str, ~typing.Any]=<factory>, seed: int | None | NotGiven = <factory>, num_inference_steps: int | NotGiven = <factory>, num_images: int | NotGiven = <factory>, image_size: str | dict[str, int] | ~pipecat.utils.types.NotGiven=<factory>, expand_prompt: bool | NotGiven = <factory>, enable_safety_checker: bool | NotGiven = <factory>, format: str | NotGiven = <factory>, negative_prompt: str | None | NotGiven = <factory>, guidance_scale: float | None | NotGiven = <factory>)[source]
Bases:
ImageGenSettingsSettings for the Fal image generation service.
- Parameters:
model – Fal.ai model identifier.
seed – Random seed for reproducible generation.
Noneuses a random seed.num_inference_steps – Number of inference steps for generation.
num_images – Number of images to generate.
image_size – Image dimensions as a string preset or dict with width/height.
expand_prompt – Whether to automatically expand/enhance the prompt.
enable_safety_checker – Whether to enable content safety filtering.
format – Output image format.
negative_prompt – Details to keep out of the generated image.
Noneomits it from the request.guidance_scale – CFG scale, how closely generation follows the prompt.
Noneleaves the model’s own default in place.
- class pipecat.services.fal.image.FalImageGenService(*, params: InputParams | None = None, aiohttp_session: ClientSession, model: str | None = None, key: str | None = None, settings: FalImageGenSettings | None = None, **kwargs)[source]
Bases:
ImageGenServiceFal’s image generation service.
Provides text-to-image generation using Fal.ai’s API with configurable parameters for image quality, safety, and format options.
- Settings
alias of
FalImageGenSettings
- class InputParams(*, seed: int | None = None, num_inference_steps: int = 8, num_images: int = 1, image_size: str | dict[str, int] = 'square_hd', expand_prompt: bool = False, enable_safety_checker: bool = True, format: str = 'png')[source]
Bases:
BaseModelInput parameters for Fal.ai image generation.
Deprecated since version 0.0.105: Use
settings=FalImageGenService.Settings(...)instead. Will be removed in 2.0.0.- Parameters:
seed – Random seed for reproducible generation. If None, uses random seed.
num_inference_steps – Number of inference steps for generation. Defaults to 8.
num_images – Number of images to generate. Defaults to 1.
image_size – Image dimensions as string preset or dict with width/height. Defaults to “square_hd”.
expand_prompt – Whether to automatically expand/enhance the prompt. Defaults to False.
enable_safety_checker – Whether to enable content safety filtering. Defaults to True.
format – Output image format. Defaults to “png”.
- __init__(*, params: InputParams | None = None, aiohttp_session: ClientSession, model: str | None = None, key: str | None = None, settings: FalImageGenSettings | None = None, **kwargs)[source]
Initialize the FalImageGenService.
- Parameters:
params –
Input parameters for image generation configuration.
Deprecated since version 0.0.105: Use
settings=FalImageGenService.Settings(...)instead. Will be removed in 2.0.0.aiohttp_session – HTTP client session for downloading generated images.
model –
The Fal.ai model to use for generation. Defaults to “fal-ai/fast-sdxl”.
Deprecated since version 0.0.105: Use
settings=FalImageGenService.Settings(model=...)instead. Will be removed in 2.0.0.key – Optional API key for Fal.ai. If provided, sets FAL_KEY environment variable.
settings – Runtime-updatable settings. When provided alongside deprecated parameters,
settingsvalues take precedence.**kwargs – Additional arguments passed to parent ImageGenService.