DALLEImageGenerator
Generates images using OpenAI's DALL-E model.
Basic Information
- Type:
haystack_integrations.generators.openai_dalle.DALLEImageGenerator
Inputs
| Parameter | Type | Default | Description |
|---|---|---|---|
| prompt | str | The prompt to generate the image. | |
| size | Optional[Literal['256x256', '512x512', '1024x1024', '1792x1024', '1024x1792']] | None | If provided, overrides the size provided during initialization. |
| quality | Optional[Literal['standard', 'hd']] | None | If provided, overrides the quality provided during initialization. |
| response_format | Optional[Optional[Literal['url', 'b64_json']]] | None | If provided, overrides the response format provided during initialization. |
Outputs
| Parameter | Type | Default | Description |
|---|---|---|---|
| images | List[str] | A dictionary containing the generated list of images and the revised prompt. Depending on the response_format parameter, the list of images can be URLs or base64 encoded JSON strings. The revised prompt is the prompt that was used to generate the image, if there was any revision to the prompt made by OpenAI. | |
| revised_prompt | str | A dictionary containing the generated list of images and the revised prompt. Depending on the response_format parameter, the list of images can be URLs or base64 encoded JSON strings. The revised prompt is the prompt that was used to generate the image, if there was any revision to the prompt made by OpenAI. |
Overview
Work in Progress
Bear with us while we're working on adding pipeline examples and most common components connections.
Generates images using OpenAI's DALL-E model.
For details on OpenAI API parameters, see OpenAI documentation.
Usage Example
components:
DALLEImageGenerator:
type: components.generators.openai_dalle.DALLEImageGenerator
init_parameters:
Parameters
Init Parameters
These are the parameters you can configure in Pipeline Builder:
| Parameter | Type | Default | Description |
|---|---|---|---|
| model | str | dall-e-3 | The model to use for image generation. Can be "dall-e-2" or "dall-e-3". |
| quality | Literal['standard', 'hd'] | standard | The quality of the generated image. Can be "standard" or "hd". |
| size | Literal['256x256', '512x512', '1024x1024', '1792x1024', '1024x1792'] | 1024x1024 | The size of the generated images. Must be one of 256x256, 512x512, or 1024x1024 for dall-e-2. Must be one of 1024x1024, 1792x1024, or 1024x1792 for dall-e-3 models. |
| response_format | Literal['url', 'b64_json'] | url | The format of the response. Can be "url" or "b64_json". |
| api_key | Secret | Secret.from_env_var('OPENAI_API_KEY') | The OpenAI API key to connect to OpenAI. |
| api_base_url | Optional[str] | None | An optional base URL. |
| organization | Optional[str] | None | The Organization ID, defaults to None. |
| timeout | Optional[float] | None | Timeout for OpenAI Client calls. If not set, it is inferred from the OPENAI_TIMEOUT environment variable or set to 30. |
| max_retries | Optional[int] | None | Maximum retries to establish contact with OpenAI if it returns an internal error. If not set, it is inferred from the OPENAI_MAX_RETRIES environment variable or set to 5. |
| http_client_kwargs | Optional[Dict[str, Any]] | None | A dictionary of keyword arguments to configure a custom httpx.Clientor httpx.AsyncClient. For more information, see the HTTPX documentation. |
Run Method Parameters
These are the parameters you can configure for the component's run() method. This means you can pass these parameters at query time through the API, in Playground, or when running a job. For details, see Modify Pipeline Parameters at Query Time.
| Parameter | Type | Default | Description |
|---|---|---|---|
| prompt | str | The prompt to generate the image. | |
| size | Optional[Literal['256x256', '512x512', '1024x1024', '1792x1024', '1024x1792']] | None | If provided, overrides the size provided during initialization. |
| quality | Optional[Literal['standard', 'hd']] | None | If provided, overrides the quality provided during initialization. |
| response_format | Optional[Optional[Literal['url', 'b64_json']]] | None | If provided, overrides the response format provided during initialization. |
Was this page helpful?