fix(images): restrict webp for gpt-image-2 and add missing model#1865
fix(images): restrict webp for gpt-image-2 and add missing model#1865Deepakhub202 wants to merge 3 commits intoopenai:masterfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2c729c04ed
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| * supported for the GPT image models. Must be one of `png`, `jpeg`, or `webp`. | ||
| */ | ||
| output_format?: 'png' | 'jpeg' | 'webp' | null; | ||
| output_format?: 'png' | 'jpeg' | null; |
There was a problem hiding this comment.
Restore
webp in image-generate output_format typing
This change narrows ImageGenerateParamsBase.output_format to png|jpeg for all models, which blocks valid requests for models that still support WebP (for example, the same file still documents WebP in generation responses/events and allows it for edits). In practice, TypeScript users can no longer pass output_format: 'webp' even when using non-gpt-image-2 models, so the SDK type now under-represents supported API behavior; this should be modeled conditionally by model instead of removing webp globally.
Useful? React with 👍 / 👎.
|
Hi, I’ve updated the fix to use conditional typing so that |
Changes being requested
Fix incorrect
output_formattyping for image generation.Instead of removing
webpglobally, this change restrictswebponly forgpt-image-2using conditional types.gpt-image-2→ allows onlypng | jpegwebpAlso updates related types to work with the new union-based structure.
Additional context & links
Related issue: #1850
The API ignores
output_format: "webp"forgpt-image-2and always returns PNG, so the SDK should reflect this behavior accurately.