-
-
Notifications
You must be signed in to change notification settings - Fork 322
[OPENAI] Support editing images with gpt-image-1 and the paint method #324
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
Open
tpaulshippy
wants to merge
34
commits into
crmne:main
Choose a base branch
from
tpaulshippy:image-edit
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 26 commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
d917ed7
merged main but still need to handle multipart connection for image e…
sbounmy f002e00
support multiple images
sbounmy 4d113ae
added image attachments
sbounmy fd85df5
fixed specs
sbounmy f5c0c81
store tokens on image
sbounmy bdb16cb
pass model so we can compute image#cost
sbounmy e765cad
able to specify options in RubyLLM#edit
sbounmy 67efbba
Merge branch 'main' of github.com:crmne/ruby_llm into paint-support-w…
sbounmy 7a55a30
update capabilities
sbounmy 5b93e9d
removed error
sbounmy a081b90
fix conneciton multipart
sbounmy 087a149
fix duplicate models json
sbounmy 1a33ce6
set headers content type
sbounmy d09a229
Merge branch 'main' into image-edit
tpaulshippy 8fd7338
Merge branch 'main' into image-edit
tpaulshippy a68c038
Get specs passing after merge
tpaulshippy 8af8551
Move paint/edit decision into OpenAI provider based on "with" parameter
tpaulshippy 873688d
Get it working with one image
tpaulshippy bf4909f
Add spec to make sure multiple images works
tpaulshippy 578e2d4
Refactor images.rb a bit and add usage to generation
tpaulshippy 92c387d
Rubocop
tpaulshippy a0f001d
Add some docs
tpaulshippy 8a1ae01
Merge branch 'main' into image-edit
tpaulshippy 2425cde
Rubocop -A
tpaulshippy 9fa1e38
No more passing connection and config around
tpaulshippy 06b0978
Rubocop -A
tpaulshippy 27c6c70
Merge branch 'main' into image-edit
tpaulshippy 06b5319
Restore line that was inadvertently removed
tpaulshippy 389ef7b
Merge branch 'main' into image-edit
tpaulshippy 7aa621b
Merge branch 'main' into image-edit
tpaulshippy 5421288
Update error and record cassettes
tpaulshippy c55cf79
Make cassettes smaller
tpaulshippy 61b0bf6
Remove cassettes in wrong place and problematic test
tpaulshippy 19fb606
Add fixture
tpaulshippy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| module RubyLLM | ||
| # A connection that uses multipart/form-data for file uploads | ||
| class ConnectionMultipart < Connection | ||
| def post(url, payload, &) | ||
| @connection.post url, payload do |req| | ||
| req.headers.merge! @provider.headers if @provider.respond_to?(:headers) | ||
| req.headers['Content-Type'] = 'multipart/form-data' | ||
| yield req if block_given? | ||
| end | ||
| end | ||
|
|
||
| def setup_middleware(faraday) | ||
| super | ||
| faraday.request :multipart, content_type: 'multipart/form-data' | ||
| end | ||
| end | ||
| end |
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
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
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
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
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
80 changes: 80 additions & 0 deletions
80
...tes/RubyLLM_Image/edit_functionality_OpenAI_/with_local_files/customizes_image_output.yml
Large diffs are not rendered by default.
Oops, something went wrong.
71 changes: 71 additions & 0 deletions
71
...e/edit_functionality_OpenAI_/with_local_files/rejects_edits_with_a_non-PNG_local_file.yml
Large diffs are not rendered by default.
Oops, something went wrong.
90 changes: 90 additions & 0 deletions
90
...it_functionality_OpenAI_/with_local_files/supports_image_edits_with_a_valid_local_PNG.yml
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.