alexrudall / ruby-openai

OpenAI API + Ruby! 🤖❤️ NEW: Assistant Vector Stores
MIT License
2.61k stars 302 forks source link

Add DALL·E 3 functionality #418

Closed Gary-H9 closed 3 months ago

Gary-H9 commented 5 months ago

Hello @alexrudall. I've created this PR to make a start on making the DALLE 3 available in the gem.

I think this PR has some way to go. In particular, I'm not sure how/if changes should be made to lib/images.rb.

I've made an addition to the spec for images. In particular I've broken out the functionality of both DALLE2 and DALLE3. At the moment there is only the ability to generate images in DALLE3 hence the omission of edits and variations.

I added a new tests for DALL·E 3 and my VCR recording.

I've also made a start on updating the README.md.

If you could let me know if this is appropriate or what else might need done I will be happy to take this as far as I can.

All Submissions:

alexrudall commented 5 months ago

Thanks! This looks good to me, although the cassettes aren't working on CI for some reason. 🦁

Gary-H9 commented 5 months ago

👋🏻 Yeah I'm not overly sure why that's happened. I'll have another look over this weekend.

Does anything else need edited anywhere? I'm unsure about what lib/images.rb. is doing in all honesty... 😂

alexrudall commented 5 months ago
Gary-H9 commented 5 months ago

👋 Hello @alexrudall, sorry for the delay looking at this. I've updated the cassettes. (No real idea what was going on on the first occasion. Deletion and re-running seems to have solved the CircleCI issues.)

I've also updated the tests / prompt to be a springer spaniel, in tribute to mine. 🫶🐶

If anyone else needs this in future I created this quick script to generate the image:

require "openai"

client = OpenAI::Client.new(access_token: "<my-api-token>")

response = client.images.generate(parameters: {prompt: "A springer spaniel cooking pasta wearing a hat of some sort", size: "1024x1792", model: "dall-e-3", quality: "hd"})
puts response.dig("data", 0, "url")
jtoy commented 5 months ago

should we mention in README for now that its not supported?

Gary-H9 commented 5 months ago

Unsure what you are referencing @jtoy.

Anything else needed on this @alexrudall?

jtoy commented 5 months ago

@Gary-H9 I mean that we don't currently have dalle3 support yet until your PR gets merged.

jtoy commented 4 months ago

@Gary-H9 fyi, i deployed your fork to production and it works great!

dcrec1 commented 3 months ago

Can this be merged?

alexrudall commented 3 months ago

Released in v6.4