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
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,6 @@ def _make_stream_request(
**parameters: Unpack[ImageGenerationParameters],
) -> AsyncIterator[dict[str, Any]]:
"""Make HTTP streaming request and return async iterator of events."""
if self.model.id != "gpt-image-1":
msg = f"Streaming not supported for model '{self.model.id}'. Only 'gpt-image-1' supports streaming."
raise ValueError(msg)

request_body["stream"] = True

if "partial_images" not in request_body:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,19 @@
),
},
),
Model(
id="gpt-image-1-mini",
provider=Provider.OPENAI,
display_name="GPT Image 1 Mini",
streaming=True,
parameter_constraints={
ImageGenerationParameter.PARTIAL_IMAGES: Range(min=0, max=3),
ImageGenerationParameter.ASPECT_RATIO: Choice(
options=["1024x1024", "1024x1536", "1536x1024", "auto"]
),
ImageGenerationParameter.QUALITY: Choice(
options=["low", "medium", "high", "auto"]
),
},
),
]
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def map(


class PartialImagesMapper(ParameterMapper):
"""Map partial_images parameter for streaming (gpt-image-1 only)."""
"""Map partial_images parameter for streaming."""

name = ImageGenerationParameter.PARTIAL_IMAGES

Expand All @@ -55,7 +55,6 @@ def map(
"""Transform partial_images into provider request.

Controls number of partial images during streaming (0-3).
Only supported by gpt-image-1 model.

Args:
request: Provider request dictionary to modify.
Expand All @@ -75,7 +74,7 @@ def map(


class QualityMapper(ParameterMapper):
"""Map quality parameter for DALL-E 3 and gpt-image-1."""
"""Map quality parameter"""

name = ImageGenerationParameter.QUALITY

Expand All @@ -90,6 +89,7 @@ def map(
Controls image quality/detail level.
- DALL-E 3: "standard" or "hd"
- gpt-image-1: "low", "medium", "high", or "auto"
- gpt-image-1-mini: "low", "medium", "high", or "auto"
- DALL-E 2: Not supported (no constraint in model)

Args:
Expand Down
Loading