IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).

Python class

GenerationOutput

GenerationOutput​

class max.pipelines.context.GenerationOutput(*, request_id, final_status, output)

source

Bases: BaseModel

Output container for image generation pipeline operations.

This class holds a list of generated images in OpenResponses API format, along with request tracking and status information. It implements the PipelineOutput protocol by providing the required is_done property.

Example:

import numpy as np
from max.pipelines.context.outputs import GenerationOutput
from max.pipelines.request import RequestID
from max.pipelines.request.open_responses import OutputImageContent
from max.pipelines.context.status import GenerationStatus

img_array = (np.random.rand(512, 512, 3) * 255).astype(np.uint8)
result = GenerationOutput(
    request_id=RequestID(value="req-123"),
    final_status=GenerationStatus.END_OF_SEQUENCE,
    output=[OutputImageContent.from_numpy(img_array, format="png")],
)
if result.is_done:
    print(f"Generated {len(result.output)} images")

Parameters:

final_status​

final_status: GenerationStatus

source

The final status of the generation process.

is_done​

property is_done: bool

source

Indicates whether the pipeline operation has completed.

Returns:

True if the generation is done (status is not ACTIVE), False otherwise.

model_config​

model_config: ClassVar[ConfigDict] = {'frozen': True}

source

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

output​

output: list[OutputContent]

source

List of OutputContent objects (text, images, etc.) representing generated content.

request_id​

request_id: RequestID

source

The unique identifier for the generation request.