-
Notifications
You must be signed in to change notification settings - Fork 351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend Images API to support Edits and Variations #62
Extend Images API to support Edits and Variations #62
Conversation
I was thinking, maybe it's best to keep one images() function and pass in an enum with the query as an associated value? Something like
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, @SunburstEnzo
Thanks for the update.
Looks like we need to upload images, not just pass their names.
The documentation is a bit odd https://platform.openai.com/docs/api-reference/images/create-edit
Do you have any working example to demonstrate the approach?
Yeah great points, I didn't fully understand it myself, so I was wondering if any image url would work or if it had to be uploaded using the Files API. I'm now on the pay as you go OpenAI plan so I'll try and see what errors I get back with a valid api key and work backwards. May be best for me to add basic Files API support and come back? |
Ok I think I've found out how to do it in part First error was that it isn't json to be sent:
So that meant tweaking the header to:
Then it was figuring out the formatting of the httpBody to send (as NSMutableData):
I found a StackOverflow article that did pretty much what I wanted (https://stackoverflow.com/a/47571172/1241153):
And it worked with the hardcoded image request (using the whitecat image in the readme as the base image)! I haven't figured out how to use the query to add the size and n properties in but I got a result: |
@SunburstEnzo, you can use |
🤦♂️ nice one! Didn't spot that, should've read more on what was already in the project. I'll try and get it working like that 👍 |
@Krivoblotsky I've updated Had to edit the
Also another white cat image but sized to 256x256 by Dall-E: |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
What
(I wasn't sure about when it should be called Image or Images, Edit or Edits, etc. but I think I was consistent at least!)
• Added ImageEditsQuery and ImageVariationsQuery (both still use ImagesResult as the response)
• Removed mention of model as a parameter for ImagesQuery in readme as that isn't currently supported
Why
More image generation abilities
Edit: #45 and #46
Affected Areas
Did not alter ImagesQuery but may be best to tweak the wording for consistency? Maybe they should all be "CreateImagesQuery", "CreateImageEditQuery", etc. – not sure
I'm not currently in a situation to use ChatGPT Plus so can't fully test
Happy to make any tweaks 👍