image

Azure OpenAI image generation service implementation.

This module provides integration with Azure’s OpenAI image generation API using REST endpoints for creating images from text prompts.

class pipecat.services.azure.image.AzureImageGenSettings(model: str | None | _NotGiven = <factory>, extra: dict[str, Any]=<factory>, image_size: str | None | _NotGiven = <factory>)[source]

Bases: ImageGenSettings

Settings for the Azure image generation service.

Parameters:
  • model – Azure image generation model identifier.

  • image_size – Target size for generated images.

image_size: str | None | _NotGiven
class pipecat.services.azure.image.AzureImageGenServiceREST(*, image_size: str | None = None, api_key: str, endpoint: str, model: str | None = None, aiohttp_session: ClientSession, api_version='2023-06-01-preview', settings: AzureImageGenSettings | None = None)[source]

Bases: ImageGenService

Azure OpenAI REST-based image generation service.

Provides image generation using Azure’s OpenAI service via REST API. Supports asynchronous image generation with polling for completion and automatic image download and processing.

Settings

alias of AzureImageGenSettings

__init__(*, image_size: str | None = None, api_key: str, endpoint: str, model: str | None = None, aiohttp_session: ClientSession, api_version='2023-06-01-preview', settings: AzureImageGenSettings | None = None)[source]

Initialize the AzureImageGenServiceREST.

Parameters:
  • image_size

    Size specification for generated images (e.g., “1024x1024”).

    Deprecated since version 0.0.105: Use settings=AzureImageGenServiceREST.Settings(image_size=...) instead.

  • api_key – Azure OpenAI API key for authentication.

  • endpoint – Azure OpenAI endpoint URL.

  • model

    The image generation model to use.

    Deprecated since version 0.0.105: Use settings=AzureImageGenServiceREST.Settings(model=...) instead.

  • aiohttp_session – Shared aiohttp session for HTTP requests.

  • api_version – Azure API version string. Defaults to “2023-06-01-preview”.

  • settings – Runtime-updatable settings. When provided alongside deprecated parameters, settings values take precedence.

async run_image_gen(prompt: str) AsyncGenerator[Frame, None][source]

Generate an image from a text prompt using Azure OpenAI.

Parameters:

prompt – The text prompt describing the desired image.

Yields:

URLImageRawFrame containing the generated image data, or ErrorFrame if generation fails.