hatch-pet: send application/json for text-only image generation requests#387
Open
gdorta wants to merge 1 commit into
Open
hatch-pet: send application/json for text-only image generation requests#387gdorta wants to merge 1 commit into
gdorta wants to merge 1 commit into
Conversation
generate_pet_images.py sent multipart/form-data for text-only image generation requests. The OpenAI Images API requires application/json for /v1/images/generations, while reference-backed image edits use multipart/form-data for /v1/images/edits. Build a JSON payload for /generations requests and keep the existing multipart upload path for /edits. Add an inline comment documenting the API contract so the next reader does not reintroduce the mismatch. Tested locally with a text-only base request and a reference-backed base request.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
generate_pet_images.pysendsmultipart/form-datafor text-only image generation requests. The OpenAI Images API rejects this on/v1/images/generations, which expectsapplication/json. Result: text-only pet generation fails withunsupported multipart/form-data; endpoint expected application/json.Reference-backed pets use
/v1/images/edits, where multipart upload remains the correct path.Fix
Build a JSON payload for text-only generation requests:
POST /v1/images/generationswithapplication/jsonPOST /v1/images/editswith multipart upload fields, unchangedAdded an inline comment documenting the API contract.
Verification
Tested locally against copied prepared run directories:
1024x1024PNGs.Context
Encountered while building The Hatchery, a marketplace for Codex pets. Happy to iterate on the fix shape if there is a preferred convention.