Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs-website/docs/concepts/pipelines/asyncpipeline.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ In an `AsyncPipeline`, components such as A and B will run in parallel _only if

You can control the maximum number of components that run simultaneously using the `concurrency_limit` parameter to ensure controlled resource usage.

You can find more details in our [API Reference](/reference/pipeline-api#asyncpipeline), or directly in the pipeline's [GitHub code](https://github.com/deepset-ai/haystack/blob/main/haystack/core/pipeline/async_pipeline.py).
You can find more details in our [API Reference](/reference/pipeline-api#pipeline), or directly in the pipeline's [GitHub code](https://github.com/deepset-ai/haystack/blob/main/haystack/core/pipeline/pipeline.py).

## Example

Expand Down
2 changes: 1 addition & 1 deletion docs-website/docs/overview/migration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ If you need help migrating a 1.x node without a 2.x counterpart, open an [issue]
| Haystack 1.x | Description | Haystack 2.x |
| --- | --- | --- |
| Ranker | Orders documents based on how relevant they are to the query. **Example usage:** In a query pipeline, after a keyword-based Retriever to rank the documents it returns. | [Rankers](../pipeline-components/rankers.mdx) |
| Reader | Finds an answer by selecting a text span in documents. **Example usage:** In a query pipeline when you want to know the location of the answer. | [ExtractiveReader](../pipeline-components/readers/extractivereader.mdx) |
| Reader | Finds an answer by selecting a text span in documents. **Example usage:** In a query pipeline when you want to know the location of the answer. | [TransformersExtractiveReader](../pipeline-components/readers/transformersextractivereader.mdx) |
| Retriever | Fetches relevant documents from the Document Store. **Example usage:** Coupling Retriever with a Reader in a query pipeline to speed up the search (the Reader only goes through the documents it gets from the Retriever). | [Retrievers](../pipeline-components/retrievers.mdx) |
| QuestionGenerator | When given a document, it generates questions this document can answer. **Example usage:** Auto-suggested questions in your search app. | Prompt [Builders](../pipeline-components/builders.mdx) with dedicated prompt, [Generators](../pipeline-components/generators.mdx) |

Expand Down
2 changes: 1 addition & 1 deletion docs-website/docs/overview/platform-components.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ The Haystack Enterprise Platform currently supports **224 components** and **55
| [DocumentWriter](https://docs.haystack.deepset.ai/docs/documentwriter) | Writer | ✅ Available |
| [DOCXToDocument](https://docs.haystack.deepset.ai/docs/docxtodocument) | Converter | ✅ Available |
| [EmbeddingBasedDocumentSplitter](https://docs.haystack.deepset.ai/docs/embeddingbaseddocumentsplitter) | Preprocessor | ✅ Available |
| [ExtractiveReader](https://docs.haystack.deepset.ai/docs/extractivereader) | Reader | ✅ Available |
| [FallbackChatGenerator](https://docs.haystack.deepset.ai/docs/fallbackchatgenerator) | Generator | ✅ Available |
| [FileToFileContent](https://docs.haystack.deepset.ai/docs/filetofilecontent) | Converter | ✅ Available |
| [FileTypeRouter](https://docs.haystack.deepset.ai/docs/filetyperouter) | Router | ✅ Available |
Expand Down Expand Up @@ -110,6 +109,7 @@ The Haystack Enterprise Platform currently supports **224 components** and **55
| [TikaDocumentConverter](https://docs.haystack.deepset.ai/docs/tikadocumentconverter) | Converter | ✅ Available |
| [ToolInvoker](https://docs.haystack.deepset.ai/docs/toolinvoker) | Component | ✅ Available |
| [TopPSampler](https://docs.haystack.deepset.ai/docs/toppsampler) | Sampler | ✅ Available |
| [TransformersExtractiveReader](https://docs.haystack.deepset.ai/docs/transformersextractivereader) | Reader | ✅ Available |
| [TransformersSimilarityRanker](https://docs.haystack.deepset.ai/docs/transformerssimilarityranker) | Ranker | ✅ Available |
| [TransformersTextRouter](https://docs.haystack.deepset.ai/docs/transformerstextrouter) | Router | ✅ Available |
| [TransformersZeroShotDocumentClassifier](https://docs.haystack.deepset.ai/docs/transformerszeroshotdocumentclassifier) | Classifier | ✅ Available |
Expand Down
2 changes: 1 addition & 1 deletion docs-website/docs/pipeline-components/generators.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ Generators are responsible for generating text after you give them a prompt. The
| [CohereChatGenerator](generators/coherechatgenerator.mdx) | Enables chat completion using Cohere's LLMs. | ✅ |
| [CohereGenerator](generators/coheregenerator.mdx) | Queries the LLM using Cohere API. | ✅ |
| [CometAPIChatGenerator](generators/cometapichatgenerator.mdx) | Enables chat completion using AI models through the Comet API. | ✅ |
| [DALLEImageGenerator](generators/dalleimagegenerator.mdx) | Generate images using OpenAI's image generation models such as `gpt-image-2`. | ❌ |
| [FallbackChatGenerator](generators/fallbackchatgenerator.mdx) | A ChatGenerator wrapper that tries multiple Chat Generators sequentially until one succeeds. | ✅ |
| [GoogleAIGeminiChatGenerator](generators/googleaigeminichatgenerator.mdx) | Enables chat completion using Google Gemini models. **_This integration will be deprecated soon. We recommend using [GoogleGenAIChatGenerator](generators/googlegenaichatgenerator.mdx) integration instead._** | ✅ |
| [GoogleAIGeminiGenerator](generators/googleaigeminigenerator.mdx) | Enables text generation using Google Gemini models. **_This integration will be deprecated soon. We recommend using [GoogleGenAIChatGenerator](generators/googlegenaichatgenerator.mdx) integration instead._** | ✅ |
Expand All @@ -45,6 +44,7 @@ Generators are responsible for generating text after you give them a prompt. The
| [OllamaGenerator](generators/ollamagenerator.mdx) | Provides an interface to generate text using an LLM running on Ollama. | ✅ |
| [OpenAIChatGenerator](generators/openaichatgenerator.mdx) | Enables chat completion using OpenAI's large language models (LLMs). | ✅ |
| [OpenAIGenerator](generators/openaigenerator.mdx) | Enables text generation using OpenAI's large language models (LLMs). | ✅ |
| [OpenAIImageGenerator](generators/openaiimagegenerator.mdx) | Generate images using OpenAI's image generation models such as `gpt-image-2`. | ❌ |
| [OpenAIResponsesChatGenerator](generators/openairesponseschatgenerator.mdx) | Enables chat completion using OpenAI's Responses API with support for reasoning models. | ✅ |
| [OpenRouterChatGenerator](generators/openrouterchatgenerator.mdx) | Enables chat completion with any model hosted on OpenRouter. | ✅ |
| [PerplexityChatGenerator](generators/perplexitychatgenerator.mdx) | Enables chat completion using models via the Perplexity Agent API. | ✅ |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
title: "DALLEImageGenerator"
id: dalleimagegenerator
slug: "/dalleimagegenerator"
title: "OpenAIImageGenerator"
id: openaiimagegenerator
slug: "/openaiimagegenerator"
description: "Generate images using OpenAI's image generation models such as `gpt-image-2`."
---

# DALLEImageGenerator
# OpenAIImageGenerator

Generate images using OpenAI's image generation models such as `gpt-image-2`.

Expand All @@ -18,45 +18,45 @@ Generate images using OpenAI's image generation models such as `gpt-image-2`.
| **Mandatory run variables** | `prompt`: A string containing the prompt for the model |
| **Output variables** | `images`: A list of generated images <br /> <br />`revised_prompt`: A string containing the prompt that was used to generate the image, if there was any revision to the prompt made by OpenAI |
| **API reference** | [Generators](/reference/generators-api) |
| **GitHub link** | https://github.com/deepset-ai/haystack/blob/main/haystack/components/generators/openai_dalle.py |
| **GitHub link** | https://github.com/deepset-ai/haystack/blob/main/haystack/components/generators/openai_image_generator.py |
| **Package name** | `haystack-ai` |

</div>

## Overview

The `DALLEImageGenerator` component generates images using OpenAI's image generation models (such as `gpt-image-2`).
The `OpenAIImageGenerator` component generates images using OpenAI's image generation models (such as `gpt-image-2`).

By default, the component uses the `gpt-image-2` model, `"auto"` quality, and 1024x1024 resolution. You can change these parameters using `model` (during component initialization), `quality`, and `size` (during component initialization or run) parameters.

`DALLEImageGenerator` needs an OpenAI key to work. It uses an `OPENAI_API_KEY` environment variable by default. Otherwise, you can pass an API key at initialization with `api_key`:
`OpenAIImageGenerator` needs an OpenAI key to work. It uses an `OPENAI_API_KEY` environment variable by default. Otherwise, you can pass an API key at initialization with `api_key`:

```
image_generator = DALLEImageGenerator(api_key=Secret.from_token("<your-api-key>"))
image_generator = OpenAIImageGenerator(api_key=Secret.from_token("<your-api-key>"))
```

Check our [API reference](/reference/generators-api#dalleimagegenerator) for the detailed component parameters description, or the [OpenAI documentation](https://developers.openai.com/api/reference/resources/images/methods/generate) for the details on OpenAI API parameters.
Check our [API reference](/reference/generators-api#openaiimagegenerator) for the detailed component parameters description, or the [OpenAI documentation](https://developers.openai.com/api/reference/resources/images/methods/generate) for the details on OpenAI API parameters.

## Usage

### On its own

```python
from haystack.components.generators import DALLEImageGenerator
from haystack.components.generators import OpenAIImageGenerator

image_generator = DALLEImageGenerator()
image_generator = OpenAIImageGenerator()
response = image_generator.run("Show me a picture of a black cat.")

print(response)
```

### In a pipeline

In the following pipeline, we first set up a `PromptBuilder` that will structure the image description with a detailed template describing various artistic elements. The pipeline then passes this structured prompt into a `DALLEImageGenerator` to generate the image based on this detailed description.
In the following pipeline, we first set up a `PromptBuilder` that will structure the image description with a detailed template describing various artistic elements. The pipeline then passes this structured prompt into an `OpenAIImageGenerator` to generate the image based on this detailed description.

```python
from haystack import Pipeline
from haystack.components.generators import DALLEImageGenerator
from haystack.components.generators import OpenAIImageGenerator
from haystack.components.builders import PromptBuilder

prompt_builder = PromptBuilder(
Expand All @@ -70,7 +70,7 @@ prompt_builder = PromptBuilder(
Additional details: {details}""",
)

image_generator = DALLEImageGenerator()
image_generator = OpenAIImageGenerator()

pipeline = Pipeline()
pipeline.add_component("prompt_builder", prompt_builder)
Expand Down
2 changes: 1 addition & 1 deletion docs-website/docs/pipeline-components/readers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ description: "Readers are pipeline components that pinpoint answers in documents

Readers are pipeline components that pinpoint answers in documents. They’re used in extractive question answering systems.

Currently, there's one Reader available in Haystack: [ExtractiveReader](readers/extractivereader.mdx).
Currently, there's one Reader available in Haystack: [TransformersExtractiveReader](readers/transformersextractivereader.mdx).
Loading